Hello all:
I'm trying to modify an existing db for someone who wants to set
appointments in a customer db. They want to prevent someone from
double booking appts.
I've developed a few lines of code to do this, but I keep getting hung
on the SQL string. Here is the code:
------
Private Function CheckAppt(SALES MAN)
Dim oAppt
Dim strMsg
This line is the one that returns the 3061 error---->
Set oAppt = Application.Cur rentDb.OpenReco rdset("SELECT * FROM
[Lead-Appiontments] WHERE SALESMAN=" & SALESMAN)
If (APPT_DATE & APPT_TIME = LEAD - Appointments.AP PT_DATE & LEAD -
Appointments.AP PT_TIME) Then
strMsg = MsgBox("This Salesman already has a appointment set for
this date/time. Please choose another.", vbCritical, "Appointmen t
Scheduler")
End If
End Function
------------
The function is called from here:
Private Sub cboSalesman_Los tFocus()
CheckAppt cboSalesman.Col umn(0, cboSalesman.Tex t)
End Sub
------------
The Select statement runs fine. I think the problem is in the WHERE
clause. WHen I try to debug, the SALESMAN clause receives the current
record name so I know that is working fine. Any clues?