G
Guest
Access 2000
I have a form I call "Pop-up Update Allocations". This form has an unbound
combo box that is used to filter the selected records that open in the next
form called "Expenditure Allocation Update". This type of filter works in
another application but the factors must be somewhat different in this
application because I get an error message even though the filter ultimately
works.
The message I get is: Run-time error '2491' The action or method is invalid
because the form or report isn't bound to a table or query.
The following is the offending code:
Private Sub Form_Open(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Pop-up Update Allocations"
stLinkCriteria = "[Pop-up Update Allocations].[cboCostCenter1]=" & "'" &
Me![CC] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub
The last line in the code is the complaining code. DoCmd.OpenForm stDocName,
, , stLinkCriteria.
As I said the Criteria links and the form's query reports the correct
records but I get the error. How can I rewrite the code to fit this
situation? I guess I really do not want to open the form "Pop-up Update
Allocations" again, I just want to link the criteria from one form to the
others to filter the records but I can't figure out how.
I have a form I call "Pop-up Update Allocations". This form has an unbound
combo box that is used to filter the selected records that open in the next
form called "Expenditure Allocation Update". This type of filter works in
another application but the factors must be somewhat different in this
application because I get an error message even though the filter ultimately
works.
The message I get is: Run-time error '2491' The action or method is invalid
because the form or report isn't bound to a table or query.
The following is the offending code:
Private Sub Form_Open(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Pop-up Update Allocations"
stLinkCriteria = "[Pop-up Update Allocations].[cboCostCenter1]=" & "'" &
Me![CC] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub
The last line in the code is the complaining code. DoCmd.OpenForm stDocName,
, , stLinkCriteria.
As I said the Criteria links and the form's query reports the correct
records but I get the error. How can I rewrite the code to fit this
situation? I guess I really do not want to open the form "Pop-up Update
Allocations" again, I just want to link the criteria from one form to the
others to filter the records but I can't figure out how.