Solved Loop through using OpenArg on main form and 2 sub forms deep

I simply added a findfirst to the listbox afterupdate to move to the correct spec. I added an event on the forms oncurrent to selected the first choice . I tried this on the onload, that event often fails on a subform because the main form is not loaded yet.
 

Attachments

That works an absolute treat!!! Seriously, thank you very much! The amount of time I spent trying to sort that out!
 
No problem. There is no way you could have explained that without providing a sample db, that form has a lot going on. Once I saw that the customer_ID did not belong, it made sense. I am guessing that is Welsh, and that made it pretty complicated to figure out.
 
Yeah, I was really struggling to find help on google because of it. I genuinely didn't think it was possible as nobody had seemed to ask it before. I'll post the answer in a bit to help other people who might have the same issue.

Yes it is Welsh. I'm impressed you knew! Not many people have heard of Wales, let alone the language. I still need to translate a lot of it. But want to get the structure in place before doing all that stuff.

Thanks again, stay safe!
 
I'm impressed you knew!
I would not be too impressed. It is not what you know, it is how good you are at Googling. Drop a word into Google and get this.
WelshDict.jpg
 
I apologize for butting in especially since I haven't been able to make sense of the thread. However, there may be a syntax error in your initial code snippet which might be what caused your problem.

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


You have only posted part of the code so there is no way for me to know if I am right but you seem to be using "Me." when referring to controls on the form so I'm assuming that FindIDCustomer is NOT a control on a form but rather a variable defined in this procedure. If that is correct, then
the DoCmd needs to be:

DoCmd.OpenForm "F_Contact_Details", , , "[IDCONTACT] = " & FindIDCustomer, , , FindIDProcess

Although the Forms! reference can be used to reference controls on a form, it CANNOT be used to reference variables in a procedure so the reference would not resolve to the actual customerID and therefore, the customer would not be found.
 
@Pat Hartman not sure of your point but both are completely legit for referencing a control
Resolve before hand
"[IDCONTACT] = " & FindIDCustomer
or have the query resolve
"[IDCONTACT]=forms![F_MainMenu]!FindIDCustomer"

Hower Me would fail in this case since the query would need a fully qualified reference.
"[IDCONTACT]=Me!FindIDCustomer" 'will not work

However, that was not related to the issue anyways.
 
Please read what I said again. I did NOT say that the reference to a control using Forms!formname!control name was not valid. I SAID that I made an ASSUMPTION (which is always dangerous) that the reverence was NOT to a control.
 
Please read what I said again. I did NOT say that the reference to a control using Forms!formname!control name was not valid. I SAID that I made an ASSUMPTION (which is always dangerous) that the reverence was NOT to a control.
Well I found your post a little strange and confusing. Clearly in post 22# the OP was satisfied with the solution I provided, which was not related to anything in your post in thread #26. So I had to ASSUME you figured something was not correct. So was not really sure the purpose of the advice since the OP's syntax was correct initially.
 
Did I apologize in advance? Did I mention that I might be out of line?

Just because the poster thinks a solution works, it might not be the best option and it might not actually work. I am not being critical of your suggestion. I didn't look deeply enough. A thread that takes over 20 posts to get to a solution is always convoluted and rarely worth investigating closely which is why I read the original post and saw what I thought was a coding error so I scanned a few others (which didn't seem to mention the potential coding error) and skipped to the end which is pretty much what I said.
 

Users who are viewing this thread

Back
Top Bottom