Link Criteria

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.
 
G

Guest

I found the error. I had a subform on the form that was not part of the
information I needed and was conflicting. As soon as I deleted the subform,
the error was gone!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top