Subject: Re: [MSAccessProfessionals] Returning to a specific record on an access form from another access form
Main form, frmOGS, control launches new form with listbox:
Private Sub Command6_Click()
DoCmd.OpenForm "frmTDAttend", acNormal
End Sub
frmTDAttend listbox:
Data source for listbox: list0= SELECT qryAttendees.[Full Name] FROM qryAttendees;
Multi Select = Simple
CmdSelect:
Private Sub cmdSelect_Click()
Dim varItem As Variant
Dim strSelected As String
Dim ctrl As Control
Set ctrl = Me.List0
If ctrl.ItemsSelected.Count > 0 Then
For Each varItem In ctrl.ItemsSelected
strSelected = strSelected & ctrl.ItemData(varItem) & "; " & (Chr(13) + Chr(10))
Next varItem
' remove leading comma
strSelected = Left(strSelected, Len(strSelected) - 2)
' assign value list to hidden text box control
Me.txtlistresults = strSelected
Debug.Print strSelected
Else
MsgBox "Noitems selected", vbInformation, "Warning"
End If
DoCmd.OpenForm "frmOGS", acNormal
[Forms]![frmOGS].[TD Invitees] = strSelected
DoCmd.Close acForm, "frmTDAttend", acSaveYes
End Sub
Sent: Sunday, April 26, 2026 10:42 AM
Subject: Re: [MSAccessProfessionals] Returning to a specific record on an access form from another access form
On Apr 26, 2026, at 8:34 AM, Dean Waring via groups.io <deanjw2006=msn.com@groups.io> wrote:
I have a main form with a control that launches a list box control. The list box is a multi-select box. Once the user selects the required choices, they select a button on the listbox form to execute the selections. The code iterates through the selections and populates a textbox on the listbox form. The textbox assigns the value to a variable that populates the main form correctly; however, when I close the listbox form, it returns to the first record in the main form instead of the record updated. How do I get the listbox form to close and return to the calling record on the main form?
Tidak ada komentar:
Posting Komentar