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 / New Users / February 2006

Tip: Looking for answers? Try searching our database.

Message Box Assisstance

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Greg - 09 Feb 2006 10:10 GMT
Hi,

I have a field DriverNo in a table called tblStaff.

I have made the property Indexed to be Yes (No  Duplicates).

I would like a message to pop up if a user tries to enter a duplicate
DriverNo.

I've never used Message Boxes before.

Thanks

Greg.
Keith Wilby - 09 Feb 2006 12:46 GMT
> Hi,
>
[quoted text clipped - 6 lines]
>
> I've never used Message Boxes before.

You will get a run-time error message for free if a duplicate entry is
attempted.

Regards,
Keith.
www.keithwilby.com
John Spencer - 09 Feb 2006 13:27 GMT
Where (from a form, from a datasheet) and When (upon entry of the data for
Driver No, when the record is saved)?

Assumption:
Entry on a form into a control.

When exiting the control after updating it, you want a message warning the
user that this is a duplicate and cannot be saved.

Private Sub txtDriverNoControlName _AfterUpdate()
IF DCount("*","TblStaff","[Driver no]=" & Chr(34) &
me.txtDriverNoControlName & Chr(34)) > 0 Then
   MsgBox "This Driver Number is a duplicate. You may not be able to save
this record",,"Suspected Duplicate"
END IF
End Sub

If Driver No is a number field and not a text field then remove the Chr(34)
from the DCount.

> Hi,
>
[quoted text clipped - 10 lines]
>
> Greg.
 
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.