Solved Combobox in a child form

silversun

Registered User.
Local time
Today, 14:10
Joined
Dec 28, 2012
Messages
204
Hi All,
I hope you all are very well.

I have a data entry form created by MS Access 2016.

I want to have a combobox that lists different items based on selction of cmb_items (like a castcaded combobox in a countinues subform). I name it cmb_packages and it gets its values from T_packages, column(1). When user selects any of the items in cmb_packages I need to have a textbox to show a short message that is again in the same table T_packages.Column(3) labeled as "msg".
I was able to setup castcaded comboboxes with the VBA's but I was stucked in this last part to show the message. :unsure:
Please see my attached db and help me if you can.
Have a nice day
Masoud
 

Attachments

Expression in textbox ControlSource: =[cmb_packages].[column](3)
 
Hi All,
I hope you all are very well.

I have a data entry form created by MS Access 2016.

I want to have a combobox that lists different items based on selction of cmb_items (like a castcaded combobox in a countinues subform). I name it cmb_packages and it gets its values from T_packages, column(1). When user selects any of the items in cmb_packages I need to have a textbox to show a short message that is again in the same table T_packages.Column(3) labeled as "msg".
I was able to setup castcaded comboboxes with the VBA's but I was stucked in this last part to show the message. :unsure:
Please see my attached db and help me if you can.
Have a nice day
Masoud
Hi Masoud

See the modified attached db
 

Attachments

combo 3 raises an error. There seems to be a typo in a control name.
 
Hi everyone. Sorry for beeing late.
I was busy with some other stuff.
I downloaded both db's you've attached but unfortunately none of them worked.
I used "=[cmb_packages].[column](3)" in my textbox's control source and nothing was showing up in the textbox when I selected any item from packages combobox.
Any idea?
I appreciate your time
 

Attachments

  • no message shown.jpg
    no message shown.jpg
    50 KB · Views: 288
I put that expression in textbox of your original posted db and it works just fine.
 
Hi
This version does work

The Column Count on the Combobox needed to be changed from 3 to 4
 

Attachments

Last edited:
Hi
This version does work

The Column Count on the Combobox needed to be changed from 3 to 4
I used this version and as soon as I select Apple in items combobox it gives me error and shows the VBA code. Once I clear the error message and select other parameters, Units and Packagin, I still don't see the message I was expecting to be appeared in textbox.
I've already changed the column number to 4.
I couldn't solve this issue.
Can you please try it one more time?
Please see the attachments.
Thanks
 

Attachments

  • apple selected.JPG
    apple selected.JPG
    35.4 KB · Views: 250
  • error is shown.jpg
    error is shown.jpg
    105.1 KB · Views: 270
  • no message shown 2.JPG
    no message shown 2.JPG
    37.2 KB · Views: 247
Last edited:
Error is with line
Me.cbopackages.RowSource = pSource

There is no control named cbopackages - drop the s at end.

Message will not display in textbox until selection in cboPackage.
 
Error is with line
Me.cbopackages.RowSource = pSource

There is no control named cbopackages - drop the s at end.

Message will not display in textbox until selection in cboPackage.
I did remove the "s" and error was gone. The message is still not showing.

I am going to respond tomorrow if you send me the solution.
Thanks for your time

Its bed time :sleep:
Good night
 

Attachments

  • no message shown 3.JPG
    no message shown 3.JPG
    43.5 KB · Views: 279
Last edited:
The cmb_Item combobox code is setting cboPackage with a RowSource that does not include msg field. Fix the code.
Code:
pSource = "SELECT package_ID, package, package_tier, msg " & _
          "FROM T_packages " & _
          "WHERE package_tier = " & Me.cmb_items.Column(2)

Really should be more consistent with prefixes used in object naming.
 
The cmb_Item combobox code is setting cboPackage with a RowSource that does not include msg field. Fix the code.
Code:
pSource = "SELECT package_ID, package, package_tier, msg " & _
          "FROM T_packages " & _
          "WHERE package_tier = " & Me.cmb_items.Column(2)

Really should be more consistent with prefixes used in object naming.
I used your solution and it works now.
Thank you
 
This is easier
Thi solution works fine and shows the messages but the problem is why I don't see correct units in my combobox cmb_units? When I select a liquid (water) I'm expecting the voluum units to be listed in my combobox. Please see the attachment.
 

Attachments

  • wrong units.JPG
    wrong units.JPG
    20.8 KB · Views: 211
I'm expecting the voluum units to be listed in my combobox
I didn't look at the database so I'm not sure what that means. If it means you want to see the quantity when the units is not Each (or whatever you use), you would change the RowSource query of the combo to concatenate the two fields.
 
Thi solution works fine and shows the messages but the problem is why I don't see correct units in my combobox cmb_units? When I select a liquid (water) I'm expecting the voluum units to be listed in my combobox. Please see the attachment.
Can you upload your latest version
 

Users who are viewing this thread

Back
Top Bottom