Dlookup VBA for multiple dates

Joined
Nov 11, 2012
Messages
1
Reaction score
0
Dear All:
I have 2 Appointment tables. I managed to prevent the user from duplicating the data by using a Dlookup code. now I am trying to do the following:
1. prevent the user from duplicating the same appointments on each tables and,
2. avoid any conflicts between the 2 tables.
1st table; Name :AssComprcd which has [ID] Autonumber field, [ComDate] and [ComTime] (Date/time Format, Short)
2nd table; OR-Lab Prcd: which has ORLabPrcdID Autonumber field, [PrcdDate] and [Prcdtim] (Date/time Format, Short)

I tried to implement the first feature using the following code but it did not work:
On Error Resume Next
Dim appconf As Long
appconf = 0
appconf = DLookup("ID", "AssComprcd", "ID<>" & ID & _
" AND ComDate = #" & ComDate & "#" & " AND Comtime = #" & ComTime & "#")
'If appconf <> 0 Then
MsgBox "Previous Appointment Exists Already", vbCritical
Cancel = 1
Me.File_no.SetFocus
End If

Your Help is highly appreciated,
Regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

DLookUp Format 4
Dlookup 7
DlookUp 5
Dlookup... 4
Help with DLookup! 3
Concatenate Date and Number field for Append Query 0
DLOOKUP FOR CALCULATED VALUES 1
Dlookup 1

Top