Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / December 2005

Tip: Looking for answers? Try searching our database.

Add record but check for existing record first

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Compuhelpmt - 01 Dec 2005 03:01 GMT
I have an add customer button that inserts a new record which works fine:

Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

But I would like it to check a home_phone field first for an existing phone
number.  If the number is already in the table, then a new record isn't
added, and the form jumps to that record. If the number isn't in the table,
then a new record is added with the new phone number "pasted" in.
Rainbow01 - 01 Dec 2005 04:26 GMT
from Rainbow01 Hong Kong

first assume phone no is your primary index key in your table

my suggestion:
make a form for input phone no. only
have 1 TextBox(PhoneNo) and 2 Button(Confirm and Close)

in Confirm_OnClick event:
1) check PhoneNo was input or not, if not, show MsgBox to user
2) you can use Dlookup function to check the PhoneNO is exist or not in table
   if exist, open another form(assume this form call PhoneRecordForm) to
show that phoneno record
   if not exist, that mean need to add new record, open PhoneRecordForm for
AddNew.

"Compuhelpmt" 來函:

> I have an add customer button that inserts a new record which works fine:
>
[quoted text clipped - 5 lines]
> added, and the form jumps to that record. If the number isn't in the table,
> then a new record is added with the new phone number "pasted" in.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.