L
Lorina
Hi
I have a report that I have on switchboard where I use a form to open the
report and enter criteria (date range). Now they want the option to sort it
by customer ID. Can I simply copy that form and change the information from
date to customer id? I tried it and it didn't work to well....
Here is my code (copy and pasted the screen)
Private Sub Command5_Click()
Dim strWhere As String
Dim strReportName As String
strReportName = "shipping"
strWhere = "1=1 "
If Not IsNull(Me.txtStartCustId) Then
strWhere = strWhere & "AND CUSTOMER_ID>= #" & _
Me.txtStartCustId & "# "
End If
If Not IsNull(Me.txtEndCustId) Then
strWhere = strWhere & " And CUSTOMER_ID <=#" & _
Me.txtEndCustId & "# "
End If
DoCmd.OpenReport strReportName, acViewPreview, , strWhere
End Sub
Private Sub txtStartDate_BeforeUpdate(Cancel As Integer)
End Sub
Private Sub Form_Load()
End Sub
I assume it's one of 2 things - strWhere = "1=1 " and/or the line : Private
Sub txtStartDate_BeforeUpdate(Cancel As Integer). I tried changin
StartDate_Before to StartCustId and it jsut hung up the report.
the error I am getting is:
Run-Time error '3075':
Syntax error in date in query expression '(1 =1 and CUSTOMER_ID > = #5028#
and Customer_ID <= #50028#)'.
Thanks in advance!
I have a report that I have on switchboard where I use a form to open the
report and enter criteria (date range). Now they want the option to sort it
by customer ID. Can I simply copy that form and change the information from
date to customer id? I tried it and it didn't work to well....
Here is my code (copy and pasted the screen)
Private Sub Command5_Click()
Dim strWhere As String
Dim strReportName As String
strReportName = "shipping"
strWhere = "1=1 "
If Not IsNull(Me.txtStartCustId) Then
strWhere = strWhere & "AND CUSTOMER_ID>= #" & _
Me.txtStartCustId & "# "
End If
If Not IsNull(Me.txtEndCustId) Then
strWhere = strWhere & " And CUSTOMER_ID <=#" & _
Me.txtEndCustId & "# "
End If
DoCmd.OpenReport strReportName, acViewPreview, , strWhere
End Sub
Private Sub txtStartDate_BeforeUpdate(Cancel As Integer)
End Sub
Private Sub Form_Load()
End Sub
I assume it's one of 2 things - strWhere = "1=1 " and/or the line : Private
Sub txtStartDate_BeforeUpdate(Cancel As Integer). I tried changin
StartDate_Before to StartCustId and it jsut hung up the report.
the error I am getting is:
Run-Time error '3075':
Syntax error in date in query expression '(1 =1 and CUSTOMER_ID > = #5028#
and Customer_ID <= #50028#)'.
Thanks in advance!