Form Filter

  • Thread starter Thread starter allie357
  • Start date Start date
A

allie357

I am getting the error:
Run time error '3075'

syntax error (missing operator in query expression 'WHERE 1=1 AND
([DateEntered]>=#01/01/2005#) AND (DateEntered] < #10/24/2006#)'

I had it working until I added the 1=1 to the Where to try to get a
form to open to the specific record in the query that the user clicked
on.

Any help is appreciated. Thanks
 
The WHERE 1=1 is not going to work, as you have already determined. Even if
it did, it would not get the form to open to the selected record.

If you can post back some detail on how the user is selecting a record,
perhaps we can recommend a solution.
 
The WHERE 1=1 does work now, but not the way I thought it would. It
does not open to the selected record clicked on but rather the first
record in the filter. This is not what I wanted.

The query is in a subform which is filtered by the main form (unbound)

The user can open a single record (in theory by clicking on that
section of the query shown in the subform) with the code below:


Sub subOpenAddingDataForm()
DoCmd.OpenForm "frmAddingData", , , "Violator_ID =" & Violator_ID

Form_frmAddingData.Caption = "Edit Data"
Form_frmAddingData.AllowEdits = False
Form_frmAddingData.AllowAdditions = False
Form_frmAddingData.AllowFilters = False
Form_frmAddingData.AllowDeletions = False
End Sub

Private Sub Violator_ID_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub
Private Sub Violation_ID_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub

Private Sub DateEntered_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub

Private Sub ViolatorsDepartmentNumber_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub

Private Sub Policy_ID_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub

Private Sub OriginalDocument_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub

Private Sub Amount_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub

Private Sub Description_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub
Private Sub MissingDocumentation_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub

Private Sub Preparer_ID_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub

The WHERE 1=1 is not going to work, as you have already determined. Even if
it did, it would not get the form to open to the selected record.

If you can post back some detail on how the user is selecting a record,
perhaps we can recommend a solution.

allie357 said:
I am getting the error:
Run time error '3075'

syntax error (missing operator in query expression 'WHERE 1=1 AND
([DateEntered]>=#01/01/2005#) AND (DateEntered] < #10/24/2006#)'

I had it working until I added the 1=1 to the Where to try to get a
form to open to the specific record in the query that the user clicked
on.

Any help is appreciated. Thanks
 
Here is an alternative for you that does work.

Put the code below in the Double Click Event of the Subform.
Rather than double clicking on a field, the user doule clicks on the record
selector for the record they want to view in form view. When the want to
return to datasheet view, double click on the record selector and it goes
back to datasheet view.

Private Sub Form_DblClick(Cancel As Integer)
If Me.CurrentView = 2 Then
DoCmd.RunCommand acCmdSubformFormView
Else
DoCmd.RunCommand acCmdSubformDatasheetView
End If
End Sub

allie357 said:
The WHERE 1=1 does work now, but not the way I thought it would. It
does not open to the selected record clicked on but rather the first
record in the filter. This is not what I wanted.

The query is in a subform which is filtered by the main form (unbound)

The user can open a single record (in theory by clicking on that
section of the query shown in the subform) with the code below:


Sub subOpenAddingDataForm()
DoCmd.OpenForm "frmAddingData", , , "Violator_ID =" & Violator_ID

Form_frmAddingData.Caption = "Edit Data"
Form_frmAddingData.AllowEdits = False
Form_frmAddingData.AllowAdditions = False
Form_frmAddingData.AllowFilters = False
Form_frmAddingData.AllowDeletions = False
End Sub

Private Sub Violator_ID_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub
Private Sub Violation_ID_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub

Private Sub DateEntered_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub

Private Sub ViolatorsDepartmentNumber_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub

Private Sub Policy_ID_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub

Private Sub OriginalDocument_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub

Private Sub Amount_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub

Private Sub Description_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub
Private Sub MissingDocumentation_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub

Private Sub Preparer_ID_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub

The WHERE 1=1 is not going to work, as you have already determined. Even if
it did, it would not get the form to open to the selected record.

If you can post back some detail on how the user is selecting a record,
perhaps we can recommend a solution.

allie357 said:
I am getting the error:
Run time error '3075'

syntax error (missing operator in query expression 'WHERE 1=1 AND
([DateEntered]>=#01/01/2005#) AND (DateEntered] < #10/24/2006#)'

I had it working until I added the 1=1 to the Where to try to get a
form to open to the specific record in the query that the user clicked
on.

Any help is appreciated. Thanks
 
Thanks, I will try it.

Here is an alternative for you that does work.

Put the code below in the Double Click Event of the Subform.
Rather than double clicking on a field, the user doule clicks on the record
selector for the record they want to view in form view. When the want to
return to datasheet view, double click on the record selector and it goes
back to datasheet view.

Private Sub Form_DblClick(Cancel As Integer)
If Me.CurrentView = 2 Then
DoCmd.RunCommand acCmdSubformFormView
Else
DoCmd.RunCommand acCmdSubformDatasheetView
End If
End Sub

allie357 said:
The WHERE 1=1 does work now, but not the way I thought it would. It
does not open to the selected record clicked on but rather the first
record in the filter. This is not what I wanted.

The query is in a subform which is filtered by the main form (unbound)

The user can open a single record (in theory by clicking on that
section of the query shown in the subform) with the code below:


Sub subOpenAddingDataForm()
DoCmd.OpenForm "frmAddingData", , , "Violator_ID =" & Violator_ID

Form_frmAddingData.Caption = "Edit Data"
Form_frmAddingData.AllowEdits = False
Form_frmAddingData.AllowAdditions = False
Form_frmAddingData.AllowFilters = False
Form_frmAddingData.AllowDeletions = False
End Sub

Private Sub Violator_ID_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub
Private Sub Violation_ID_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub

Private Sub DateEntered_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub

Private Sub ViolatorsDepartmentNumber_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub

Private Sub Policy_ID_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub

Private Sub OriginalDocument_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub

Private Sub Amount_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub

Private Sub Description_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub
Private Sub MissingDocumentation_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub

Private Sub Preparer_ID_DblClick(Cancel As Integer)
Call subOpenAddingDataForm
End Sub

The WHERE 1=1 is not going to work, as you have already determined. Even if
it did, it would not get the form to open to the selected record.

If you can post back some detail on how the user is selecting a record,
perhaps we can recommend a solution.

:

I am getting the error:
Run time error '3075'

syntax error (missing operator in query expression 'WHERE 1=1 AND
([DateEntered]>=#01/01/2005#) AND (DateEntered] < #10/24/2006#)'

I had it working until I added the 1=1 to the Where to try to get a
form to open to the specific record in the query that the user clicked
on.

Any help is appreciated. Thanks
 
Back
Top