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(SALESMAN)
Dim oAppt
Dim strMsg
This line is the one that returns the 3061 error---->
Set oAppt = Application.CurrentDb.OpenRecordset("SELECT * FROM
[Lead-Appiontments] WHERE SALESMAN=" & SALESMAN)
If (APPT_DATE & APPT_TIME = LEAD - Appointments.APPT_DATE & LEAD -
Appointments.APPT_TIME) Then
strMsg = MsgBox("This Salesman already has a appointment set for
this date/time. Please choose another.", vbCritical, "Appointment
Scheduler")
End If
End Function
------------
The function is called from here:
Private Sub cboSalesman_LostFocus()
CheckAppt cboSalesman.Column(0, cboSalesman.Text)
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?