|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello,
I'm trying to create a drop down box, so that the end user can choose a table heading. Once they choose that table heading, they will get a popup that will ask what they want to search/query for. For example, I have 5 table heading which are labeled "Manufacturer", "Product Name", "Type of Product", and "Box Number". The end user would go to the drop down box and choose the heading "Manufacturer". Next they should be prompted to "Enter Keyword". They would enter "Microsoft". Finally, a listing of all Microsoft items would pull up from the table. I have a button created that will run a query on the column "Product Name". For example, the end user will click on a button called "Run Query". Once they click on this button, they are prompted to "Enter Keyword". Once they enter something like "Word", everything with "Word" in the "Product Name" column of my table will pull. I need to create a drop down box which will give my user the option of choosing any column in the table to do a search on. If anyone has a way of doing this, I would really appreciate it. Thank you. Dawn |
|
#2
|
|||
|
|||
|
Hi there,
what language are you writing this in? PHP or ASP or other? the theory is the same what ever you are writing it in... open the DB table "products" (or whatever!) using and SQL... "SQL = SELECT column_headers FROM product;" then using a while loop output the results in to the drop down box... something like: ( i will write in ASP... but it can easily be converted in to PHP) (comments in //) //first draw the beginning of the <select> box (the drop down box) <select name="select_colum"> <% while NOT objRS.EOF //start loop to get results response.write "<option value=" & objRS("column_name") & ">" & objRS("column_name") & "</option> wend // end loop %> </select> if there were say 4 records in the "products" table (4 different headings say) the drop down menu would look like: <select name="select_column"> <option value="Product_Name">Product_Name</option> <option value="Manufacturer">Manufacturer</option> <option value="Type_of_Product">Type_of_Product</option> <option value="Box_Number">Box_Number</option> </select> I hope this goes some way to helping you.... let me know if I have understood you correctly! Regards, |
|
#3
|
|||
|
|||
|
forgot to say that you will need to say
objRS.MoveNext before the "wend" part...otherwise it wont move to the next record and you'll get an error msg! |
|
#4
|
|||
|
|||
|
Hello Matt,
I'm pretty new to the behind the scenes workings of Microsoft Access, so I'm not entirely sure where to put this code. Would I go into Build Event to start this or should I create another new button and start over. Please help. Thank you. Dawn Quote:
|
|
#5
|
|||
|
|||
|
what are you making the website in!?
|
|
#6
|
|||
|
|||
|
Hello. This isn't a website. I'm actually working in Microsoft Access 97. The user has an Inventory database that they need to be able to query off of. Right now, I have it setup so the user can click on a button and type in "Windows" and all of the items in the Manufacturer column with the word "Windows" will come up in a table. I used the code {Like "*" & [Enter Keyword] & "*"}, without the brackets in the Manufacturer column, but when I use it in the criteria column of the other columns it will not work. I need to find a way to reference each column header in my table, so that I will only get query results from that particular column. Therefore, I have 5 columns with the headings Product Name, Type of Product, Manufacturer, ID/Serial Number, and Box Number. I need to find a way to specify each column header in my criteria, so that I will only get results from that particular column. So, the user will be able to go to the drop down box that I've created and choose "Type of Product". Then a box will pop up and the user can type in "Software". Finally, all of the items in the "Type of Product" column withe the word "Software" will come up in a table. I have this working for one column, but the putting the same criteria in each column does not work. Any suggestions would be greatly appreciated. Thank you in advance.
|
|
#7
|
|||
|
|||
|
aaah I see...so you are using forms? Well, I have the Access 97 bible (over 1000 pages..!) so I'll have a squiz through and see what I can find... not used access like that for a few years!!
I'll get back to you asap! |
|
#8
|
|||
|
|||
|
Thank you. I'm going to try a few things on my end too.
Dawn |
|
#9
|
|||
|
|||
|
Ok Here it is
Are You Ready! Probably Not but here it is:
[img]mk:@MSITStore:C:Program%20FilesMicrosoft%20OfficeO ffice101033acmain10.chm::/images/collapsetri.gif[/img]Hide All Create a form to enter report criteria
|
|
#10
|
|||
|
|||
|
Part II
<LI>
|
|
#11
|
|||
|
|||
|
Part III
Hopefully you can do this. It took me awhile to figure it out. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > How do I create a drop down box? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|