form linking

xveganx007

Registered User.
Local time
Today, 14:38
Joined
Apr 4, 2000
Messages
10
when opening a new form from a command button, how can i link the forms using 2 data fields here is the code i have so far (linking just one of the fields, this was made using the command button wizard, i have little vba knowledge):


Private Sub Change_Data_Click()
On Error GoTo Err_Change_Data_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "QA SALP Data - Add screen"

stLinkCriteria = "[AUDIT_NO]=" & "'" & Me![AUDIT_NO] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Change_Data_Click:
Exit Sub

Err_Change_Data_Click:
MsgBox Err.Description
Resume Exit_Change_Data_Click

End Sub

the other field is in the same table and is called INDXITMNO
any help would be greatly appreciatted
 
Change the line

stLinkCriteria = "[AUDIT_NO]=" & "'" & Me![AUDIT_NO] & "'"

to

stLinkCriteria = "[AUDIT_NO]=" & "'" & Me![AUDIT_NO] & "' and [INDXITMNO] = '& me![indxitmno] &"'"

where the value on the form is me![indxitmno]
 
Thanks Nick,
it work great
 

Users who are viewing this thread

Back
Top Bottom