Passing variables in an OpenForm Method

Dalorax

Registered User.
Local time
, 18:31
Joined
Aug 8, 2005
Messages
12
I can't seem to get the following code to work.
Any help would be appreciated:
PHP:
Public Function NonConform(strProduct, strBatch As String)

On Error GoTo HandleErr
Dim stDocName As String
Dim stLinkCriteria As String

    stDocName = "frmProductNonConforming"
    stLinkCriteria = "[ProductName]=" & "'" & strProduct & "'"
    stLinkCriteria = stLinkCriteria & "AND [BatchNum]=" & "'" & strBatch & "'"
    DoCmd.OpenForm stDocName, , , (stLinkCriteria)    
HandleErr:
    MsgBox "Error in NonConform Function : " & Err.Description
    Resume Next
End Function
 
Last edited:
Try it without the parens:
DoCmd.OpenForm stDocName, , , stLinkCriteria

Which should work as long as [ProductName] and [BatchNum] are text fields.
 

Users who are viewing this thread

Back
Top Bottom