L
LBN
I have a user update form - frmUpdate and a search form - frmSearch. The
search form runs off a query; the header has searchable fields: CompanyName,
ItemName, Model, SerialNumber. The Details sections includes these fields
and PID which is a Primary key on the Products table. Based on the search
selections I get multiple records (expected). I would like to use the search
list records as a filter to open the 'frmUpdate'. I have created a command
button on the 'frmSearch' header and put in the following code. This opens
'frmUpdate' but only with the first record in the search list. What am I
doing wrong? I have spent the last week playing with this, searching through
many forums, and searching the help sections, but no go. Thanks!
Private Sub cmdOpenUpdate_Click()
On Error GoTo Err_cmdOpenUpdate_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmUpdate"
stLinkCriteria = "[PID]=" & Me![PID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdOpenUpdate_Click:
Exit Sub
Err_cmdOpenUpdate_Click:
MsgBox Err.Description
Resume Exit_cmdOpenUpdate_Click
End Sub
search form runs off a query; the header has searchable fields: CompanyName,
ItemName, Model, SerialNumber. The Details sections includes these fields
and PID which is a Primary key on the Products table. Based on the search
selections I get multiple records (expected). I would like to use the search
list records as a filter to open the 'frmUpdate'. I have created a command
button on the 'frmSearch' header and put in the following code. This opens
'frmUpdate' but only with the first record in the search list. What am I
doing wrong? I have spent the last week playing with this, searching through
many forums, and searching the help sections, but no go. Thanks!
Private Sub cmdOpenUpdate_Click()
On Error GoTo Err_cmdOpenUpdate_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmUpdate"
stLinkCriteria = "[PID]=" & Me![PID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdOpenUpdate_Click:
Exit Sub
Err_cmdOpenUpdate_Click:
MsgBox Err.Description
Resume Exit_cmdOpenUpdate_Click
End Sub