R
r. howell
I have two procedures. One does what I expect it to (opens the report showing
the appropriate data based on the "stWhere" string. The second produces
"error#" where the data should be in the report. The two stWhere's are
This one works:
stWhere = "([StDate]=#" & Me.StDate & "#) “
This one doesn't work:
stWhere = "([EndDate]=#" & Me.txtEndDate & "#) “
I can't see the difference that could be causing the problem.
Anyone else see the problem?
Thanks for any help you can give.
The rest of the code is as follows:
This doesn't work:
Private Sub Command5_Click()
On Error GoTo Err_Command5_Click
Dim stDocName As String
Dim stWhere As String
stWhere = "([EndDate]=#" & Me.txtEndDate & "#) "
stDocName = "BasicTime"
DoCmd.OpenReport stDocName, acPreview, , stWhere
Exit_Command5_Click:
Exit Sub
Err_Command5_Click:
MsgBox Err.Description
Resume Exit_Command5_Click
End Sub
This code, which to me seems identical except for the names of the fields,
runs just fine:
Private Sub Command5_Click()
On Error GoTo Err_Command5_Click
Dim stDocName As String
Dim stWhere As String
stWhere = "([StDate]=#" & Me.StDate & "#) “
stDocName = "BasicTime"
DoCmd.OpenReport stDocName, acPreview, , stWhere
Exit_Command5_Click:
Exit Sub
Err_Command5_Click:
MsgBox Err.Description
Resume Exit_Command5_Click
End Sub
the appropriate data based on the "stWhere" string. The second produces
"error#" where the data should be in the report. The two stWhere's are
This one works:
stWhere = "([StDate]=#" & Me.StDate & "#) “
This one doesn't work:
stWhere = "([EndDate]=#" & Me.txtEndDate & "#) “
I can't see the difference that could be causing the problem.
Anyone else see the problem?
Thanks for any help you can give.
The rest of the code is as follows:
This doesn't work:
Private Sub Command5_Click()
On Error GoTo Err_Command5_Click
Dim stDocName As String
Dim stWhere As String
stWhere = "([EndDate]=#" & Me.txtEndDate & "#) "
stDocName = "BasicTime"
DoCmd.OpenReport stDocName, acPreview, , stWhere
Exit_Command5_Click:
Exit Sub
Err_Command5_Click:
MsgBox Err.Description
Resume Exit_Command5_Click
End Sub
This code, which to me seems identical except for the names of the fields,
runs just fine:
Private Sub Command5_Click()
On Error GoTo Err_Command5_Click
Dim stDocName As String
Dim stWhere As String
stWhere = "([StDate]=#" & Me.StDate & "#) “
stDocName = "BasicTime"
DoCmd.OpenReport stDocName, acPreview, , stWhere
Exit_Command5_Click:
Exit Sub
Err_Command5_Click:
MsgBox Err.Description
Resume Exit_Command5_Click
End Sub