Hello
I have spent the best part of the day on lockdown trying to sort an issue out - what I want to do is so simple, yet seems the most complicated thing I've come across so far in VBA. I have tried everything I can find online without any luck! So any help would be great. I am at desperation point now to be honest.
Anyway, I have a contact form linked to an order history subform (parent and child) linked to a products ordered subform (parent and child) all run off a query. I want most things to be run off one form to make it more user friendly. Not a big fan of overlapping forms. I have a main menu with a listbox with the records relating to the query. I simply want the correct record to open up when I double click it. I have the code below already which loads up the correct information up to the first subform, but not the 2nd.
This is the vb in the listbox on the main menu.....
Code Tags Added by UG
Please use Code Tags when posting VBA Code
https://www.access-programmers.co.u...e-use-code-tags-when-posting-vba-code.240420/
This is then in the 'on load' event on the parent form with the 2 subforms
I have tried the code below, but it returns an error that the record is locked
Can anyone help at all? I'm not even sure how possible it is. If so, I will need to modify the design of the system. Thanks in advance.
I have spent the best part of the day on lockdown trying to sort an issue out - what I want to do is so simple, yet seems the most complicated thing I've come across so far in VBA. I have tried everything I can find online without any luck! So any help would be great. I am at desperation point now to be honest.
Anyway, I have a contact form linked to an order history subform (parent and child) linked to a products ordered subform (parent and child) all run off a query. I want most things to be run off one form to make it more user friendly. Not a big fan of overlapping forms. I have a main menu with a listbox with the records relating to the query. I simply want the correct record to open up when I double click it. I have the code below already which loads up the correct information up to the first subform, but not the 2nd.
This is the vb in the listbox on the main menu.....
Code Tags Added by UG
Please use Code Tags when posting VBA Code
https://www.access-programmers.co.u...e-use-code-tags-when-posting-vba-code.240420/
Code:
FindIDProcess = Me.StatusListBox.Column(0)
FindIDCustomer = Me.StatusListBox.Column(1)
FindIDSpec = Me.StatusListBox.Column(6)
DoCmd.OpenForm "F_Contact_Details", , , "[IDCONTACT]=forms![F_MainMenu]!FindIDCustomer", , , FindIDProcess
Forms!F_Contact_Details!ContactViewedAt = Now()
Me.RecentContactsListBox.Requery
End If
This is then in the 'on load' event on the parent form with the 2 subforms
Code:
Dim strOpenArgs() As String
If Not IsNull(Me.OpenArgs) Then
Me.SF_Quote.SetFocus
Me.SF_Quote.Form!IDORDERPROCESS.SetFocus
DoCmd.FindRecord Me.OpenArgs
Me.SF_Quote.Form!Proses.SetFocus
Forms![F_Contact_Details]![SF_Quote]![SF_DrumOrderSpec].Form!OtherDrumsListBox.Requery
end if
Code:
FindIDProcess = Me.StatusListBox.Column(0)
FindIDCustomer = Me.StatusListBox.Column(1)
FindIDSpec = Me.StatusListBox.Column(6)
DoCmd.OpenForm "F_Contact_Details", , , "[IDCONTACT]=forms![F_MainMenu]!FindIDCustomer", , , FindIDSpec
Forms!F_Contact_Details!ContactViewedAt = Now()
Me.RecentContactsListBox.Requery
End If
Dim strOpenArgs() As String
If Not IsNull(Me.OpenArgs) Then
Me.SF_Quote!SF_DrumOrderSpec.SetFocus
Me.SF_Quote!SF_DrumOrderSpec.Form!IDORDERSPEC.SetFocus
DoCmd.FindRecord Me.OpenArgs
Me.SF_Quote.Form!Proses.SetFocus
Forms![F_Contact_Details]![SF_Quote]![SF_DrumOrderSpec].Form!OtherDrumsListBox.Requery
end if
Last edited by a moderator: