I have tried, it can open up everything of another form but I want to know what is the code, if it selective of supplier code.
So, I will go to the supplier masterlist say the supplier code is SPD, then when I click the button, it should give me the datalist of another form what relate to spd only.
Private Sub [COLOR=Red]cmdButtonName[/COLOR]_Click()
On Error GoTo Exit_[COLOR=Red]cmdButtonName[/COLOR]_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "[COLOR=Red]FormName[/COLOR]"
stLinkCriteria = "[[COLOR=Red]SuppID[/COLOR]]= '" & [COLOR=Red]cmbSuppID [/COLOR] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_[COLOR=Red]cmdButtonName[/COLOR]_Click:
Exit Sub
Err_[COLOR=Red]cmdButtonName[/COLOR]_Click:
MsgBox Err.Description
Resume Exit_[COLOR=Red]cmdButtonName[/COLOR]_Click
End Sub
I am not sure if it helps. For your reference, change the code coloured in red to suit your forms. Your other form should be in continuous form, or else it will only displays only one record eventhough there are more than 1. Good Luck
Private Sub [COLOR=Red]cmdButtonName[/COLOR]_Click()
On Error GoTo Exit_[COLOR=Red]cmdButtonName[/COLOR]_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "[COLOR=Red]FormName[/COLOR]"
stLinkCriteria = "[[COLOR=Red]SuppID[/COLOR]]= '" & [COLOR=Red]cmbSuppID [/COLOR] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_[COLOR=Red]cmdButtonName[/COLOR]_Click:
Exit Sub
Err_[COLOR=Red]cmdButtonName[/COLOR]_Click:
MsgBox Err.Description
Resume Exit_[COLOR=Red]cmdButtonName[/COLOR]_Click
End Sub
I am not sure if it helps. For your reference, change the code coloured in red to suit your forms. Your other form should be in continuous form, or else it will only displays only one record eventhough there are more than 1. Good Luck