command button open new form problem

mrrayj60

Registered User.
Local time
Yesterday, 19:20
Joined
Sep 3, 2009
Messages
103
This will open my new form but its not record that I left from, its the 1st record of the table. The new form also has the same names txtubl.
It also pops up a new window to enter the parameter value. Isnt that the forms txtubl? Tried alot of fixes and I cant get it right and need some help.
Thanks Ray



Private Sub cmdcomplaint_Click()
On Error GoTo Err_cmdcomplaint_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "vrcedit"
stLinkCriteria = "[txtubl]=" & "'" & Me![UBL] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria


Exit_cmdcomplaint_Click:
Exit Sub
Err_cmdcomplaint_Click:
MsgBox Err.Description
Resume Exit_cmdcomplaint_Click

End Sub
 
lookk up "filter" "filteron" and "filteronload" in the VBA help menu. or...the WHERE argument in the docmd command.
 
If Me![UBL] is a Text field, then

Code:
stLinkCriteria = "[txtubl]=" & "'" & Me![UBL] & "'"
should be:

Code:
stLinkCriteria = "[txtubl]= '" & Me![UBL]  & "'"
If it's a Number field, the syntax would be:
Code:
stLinkCriteria = "[txtubl]= " & Me![UBL]
 

Users who are viewing this thread

Back
Top Bottom