On Apr 30, 2026, at 4:00 PM, Dean Waring via groups.io <deanjw2006=msn.com@groups.io> wrote:
Thank you again for your insights. My listboxes allow for users to select individuals who attend meetings. A user can select one or fifty. I do have a table of attendees from which the elections can be made. I am not sure what a better way would be and would appreciate your thoughts. The field is just a textbox.
Dean J. Waring
From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Duane Hookom via groups.io <duanehookom=hotmail.com@groups.io>
Sent: Tuesday, April 28, 2026 11:40 AM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: Re: [MSAccessProfessionals] Returning to a specific record on an access form from another access formHi Dean,Glad to hear you got this sorted out.
It looks like you are storing multiple attendee values in a single field. This goes against basic normalization rules. Typically, there would be a related child table that would store one attendee per record. If your current table structure works, then continue on. I have found these multi-value fields very limiting when considering future functionality.
I like your control named "txtlistresults". You might want to consider changing some other control names in the future to make your application more "self-documented".
Regards,Duane
From: Dean Waring
Subject: Re: [MSAccessProfessionals] Returning to a specific record on an access form from another access formThank you for your reply, and I apologize for my vague problem description. However, I believe that I was able to find a fix based on your questions. Below is some of the code. You may have a better solution. The issue appeared to be that I was re-opening the main form causing it to go to record 1. Here is what I came up with:
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
Dean J. Waring
From: Duane Hookom
Sent: Sunday, April 26, 2026 10:42 AM
Subject: Re: [MSAccessProfessionals] Returning to a specific record on an access form from another access formI’m not sure what you mean by “launches a list box control”. Are you opening a new form that contains the list box? Does your main form remain open? Is the new form opened in dialog mode?
We would need to see some code. It seems like you have a requery in your code that would reset the main form’s position to the first record.
Duane Hookom
Sent from my mobile
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