I have a continuous form in Access. The detail is set up with a button in the detail for every record. The button has on-click code to launch a pop-up form with detail about that record. I have record selectors showing, and those show that when I click a command button, the record selector for the current record is selected. I put a stop in my code when the form is opened and the criteria shows the current selected criteria correctly. when the form opens, it opens to the first record in the record set from the main form, instead of the current selected record on the main form.
I have been searching all over, figuring this has to have been answered, but I can't seem to find a solution that will work right for me.
Below is my code. If anyone can assist, I would really appreciate it.
Private Sub cmdOpenDetails_Click()
Dim rst As Recordset
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAssetDetail"
With rst
Me.txtAssetTag.SetFocus
stLinkCriteria = Me.txtAssetTag.Value
DoCmd.OpenForm stDocName, acNormal, "Forms![frmAssetDetail].AssetTag = ' " & stLinkCriteria & " ' "
Forms!frmAssets.Visible = False
End With
End Sub
One way to solve this:
The command button opens a form with the ID parameter, as in:
DoCmd.OpenForm "frmAddresseeEdit", , , , , , Me.ID
The form (in this case "frmAddresseeEdit") has as its Record source qrySelectedAddressee
This query has the fields required by the form and its criterion is
id = [Forms]![frmAddresseeEdit].[OpenArgs]