473,383 Members | 1,818 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

How to get instructions to display in text box when I select the model?

I'm having a complete headache over how i get something i want to display in a text box to be a result of something i've selected in the combo box???

Very simple database, all it does is:

Select the "Brand" in the first combo box

Which then filters the second combo box to only show the "Product" types for that brand.

Next when the "Product" is selected in the combo box I want it display the "Instructions" for that product in a text box ("Instructions" is on the same line in my table).

I can get the text box to display "ProductID" or same result as the product selected and thats it!!!

Please help!!
This is a favour for some people i used to work with. I'm only used to producing form designs etc. so I'm way out of my deph here.

Here's some of my VB code if that helps:
Expand|Select|Wrap|Line Numbers
  1. Private Sub CategoryID_Change()
  2.  
  3.     ProductID.Value = Null
  4.     ProductID.Requery
  5.  
  6. End Sub
  7.  
  8. Private Sub Detail_Click()
  9.  
  10. End Sub
  11.  
  12. Private Sub Form_Current()
  13.  
  14.     ProductID.Requery
  15.  
  16. End Sub
  17.  
  18. Private Sub ProductID_AfterUpdate()
  19. Instructions = DLookup("Instructions", "Products", "ProductID=" & ProductID)
  20.  
  21. End Sub
  22.  
  23. Private Sub Text5_BeforeUpdate(Cancel As Integer)
  24.  
  25. End Sub
  26.  
  27. Private Sub Text9_AfterUpdate()
  28. Instructions = DLookup("Instructions", "Products", "ProductID=" & ProductID)
  29.  
  30. End Sub
Many Thanks
Bunny
Nov 18 '10 #1
3 2461
NeoPa
32,556 Expert Mod 16PB
What you need is to have a multi-column ComboBox, but set it so that only the column indicating the product itself is showing.

When that's set up you want a ComboBox_AfterUpdate() event procedure, which will run any time the selection is changed, to get the hidden value and assign it to the TextBox.

Does that sound like something you could work with? If there are any steps you need further detail on just specify and I'm sure we can help further (though for more detail we'd appreciate the names of the objects we'd have to work with).
Nov 18 '10 #2
munkee
374 256MB
I just thought I would comment here. I love the approach NeoPa. In my narrow view I would have just used a select case in vba to update the textbox with a value dependent on what value is selected in the combo. However, your option gives the possibility to upsize very easily without having to change any coding.

Good fix!
Nov 19 '10 #3
NeoPa
32,556 Expert Mod 16PB
Thanks Munkee :-)

Here's another very interesting way to do it. The Help system says it's not supported, and when you enter it there is an error message saying the same. Nveretheless it seems to work. Try it.

This example code assumes you have a ComboBox called [ProductID] and it has three columns.
  1. The ID itself. Hidden.
  2. The product name of some sort. Showing as the only visible column.
  3. The Instructions you need displayed in the TextBox. Also hidden.

Expand|Select|Wrap|Line Numbers
  1. =[ProductID].[Column](2)
Nov 19 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: David | last post by:
Dear All, I wanna display text after typing "conn / as ..." in sqlplus . How can I do that ? I think I have to create a trigger on that. However, I havent any idea how to construct it. Thanks a...
1
by: Amish | last post by:
Hi, I have CSS based popup menus which display over a select list. Everything works fine with Mozilla and Firefox but in IE the select list is always on top of the display block. The z-index as...
1
by: iggie | last post by:
Hello, everyone. How can I display text from another form that currently has the focus. I'm doing a search in sql 2000, to dot it. I call a search form and query my criteria, when it founds the...
19
by: dmiller23462 | last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript but my end result is I need two text boxes to stay hidden until a particular option is selected....I've cobbled together the...
3
by: abc my vclass | last post by:
My win-form have many numericupdown controls to applied. But numericupdown control don't like textbox, text box control can automatic selected text when got focus. Is there any method can let me...
3
by: ASP Developer | last post by:
I have a variety of pages that use a master page. For some reason when I attempt to copy any of the label text on the screen it seems to highlight most of the screen randomly and I can't simply...
2
by: Ted Ngo | last post by:
Hi All, I did create a dropdownbox and populate the data from the database. I want the user able to enter the text or select data from the dropdownlist box. When the user enter the text and if...
9
by: Edward | last post by:
IE6 only displays certain text on my site if you mouse over it (!). I reduced the HTML down to this code below which still shows this effect/bug. My temporary solution was to take out all the...
3
by: WebNewbie | last post by:
Hi, please help I've been wrestling with this for a very long time and its not working. I'm trying to display text files from a database when someone selects one or more list items of my listbox. The...
10
by: removeps-groups | last post by:
How to display table and select next to each other? <html> <body> <table border=1 style="display:inline-table"> <tr><td>Hello1</td></tr> <tr><td>Hello2</td></tr> <tr><td>Hello3</td></tr>...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.