Got to work on this a bit more during the week. I can create the search successfully using input boxes. When I try to do it using text fields I get the error: "You entered an expression that has an invalid reference to the property bookmark"
Can anyone spot an error with this code?
Private Sub cmdSearch_Click()
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sSQL As String
Set cn = CurrentProject.Connection
sSQL = "select * from CorrespRec where "
sSQL = sSQL & " Month = " & Month.Value
sSQL = sSQL & " and Year = " & Year.Value
sSQL = sSQL & " and Centre = " & Centre.Value
sSQL = sSQL & " and [Session] = " & Session.Value
sSQL = sSQL & " and DS = " & DS.Value
sSQL = sSQL & " and Bar = " & Bar.Value
sSQL = sSQL & " and DOB = #" & Mid(DOB, 3, 2) & "/" & Left(DOB, 2) & "/" &
Right(DOB, 4) & "#"
sSQL = sSQL & " and CHI = " & CHI.Value
sSQL = sSQL & " and DateComm = #" & Mid(DateComm, 3, 2) & "/" &
Left(DateComm, 2) & "/" & Right(DateComm, 4) & "#"
Set rs = cn.Execute(sSQL)
DoCmd.OpenForm "CorrespRecTabbed"
[Forms]![CorrespRecTabbed].RecordSource = strSQL
DoCmd.Close acForm, "CorrespRecSearch1"
End Sub
I'd appreciate the help!