something wrong with docmd.openform criteria

  • Thread starter Thread starter meddoc
  • Start date Start date
M

meddoc

Guest
I have this code in one of my forms so as to open a new form with the records filtered according to the value of a textbox (Me!GPnumber).

Private Sub Command51_Click()
On Error GoTo Err_Command51_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "PDFamil_frm"

stLinkCriteria = "[GPnumber] =" & Str(Me!GPnumber)

DoCmd.OpenForm stDocName, , , , stLinkCriteria

Exit_Command51_Click:
Exit Sub

Err_Command51_Click:
MsgBox Err.Description
Resume Exit_Command51_Click

End Sub

The problem is that when open, it is giving me an enter parameter value box asking for GPnumber value. As I have used this system before without any problems, I am realy lost at what could have been happening.

Any ideas? Thanks
 
Check the RecordSource of the "PDFamil_frm".

does it include the GPnumber field?
does it have a different name? (i.e. Expr1)
 
And the Str function will return a leading space when the
number is positive.

Wayne
 
Thanks alot. You have been of help though this has worked fine:

stLinkCriteria = "[GP number]=" & Me![GPnumber]
 

Users who are viewing this thread

Back
Top Bottom