![]() |
| |||||||
| Sponsored Links |
![]() | « Previous Thread | Next Thread » |
| | LinkBack (1) | Thread Tools | Display Modes |
#1
| |||
| |||
| Trying to get this query to run but having issues....errors out on the FROM statememt I am trying to incoporate a variable in the SELECT statement...the variable is actually a field in the table Thoughts? Code: Dim varFieldType As String varFieldType = Combo85 'MsgBox varFieldType Dim MySQL As String 'MySQL = "SELECT dbo_Core2.'" & varFieldType & "' FROM dbo_Core2 GROUP BY dbo_Core2.'" & varFieldType & "';" |
| Sponsored Links |
|
#2
| ||||
| ||||
| Remove the single quotes. Because these are actual field names, you don't need them. Example: the above would output this as the field name in the query: dbo_Core2.'YourFieldName' Obviously, not what you want
__________________ jmurrayhead If you agree with me... click the icon! If my post solved your problem, click the button in the lower right-hand corner of the post.Join our Folding team: DeveloperBarn Folding |
|
#3
| ||||
| ||||
| this should "hopefully" be cleared up in my sample on http://www.developerbarn.com/microso...x-another.html thanks AOG let me know if you have any problems
__________________ If i helped you, make me famous by clicking the |
|
#4
| ||||
| ||||
| Check out this sample. I live in Illinois, so, naturually, it has more records. |
|
#5
| |||
| |||
| Thats Exactly what I have been looking for... I was close on my query but was missing the WHERE clause... I made a query in the query builder to grab jsut the unique values from that field and was going from that.... Either way I was all mixed up.... What you have is exaclty what I was looking for... THank you very much...your help is very appreciated... Have a great day.... |
|
#6
| ||||
| ||||
| well, it's kind of a tricky process when you do it that way..... heh you have to have the form control name to put in the criteria of the query, but you can't build the form control until you have the query in place. I usually build the query, then the form, then go back and edit the query to add the form controls. Very little code is needed by the way. |
|
#7
| |||
| |||
| WAIT A SECOND....that was not it... Sorry about that... Field 1, Field2, Field3 x c b x c g e g l What I have is a drop down that shows the field names When I choose Field 3 I want to populate the other drop down box with (b, g, l) THen if I change the to field1 I want the other dropdown (the same as above) to update to (x, x, e) That make sense? THanks for your patience and help I can then take these dropdowns and write them to variables to base queries off of... Field1 X, or Field2c etc THanks again |
|
#8
| ||||
| ||||
| Ok, say we have 3 field names....... State, Region, City You're wanting a combo box to choose the field to populate the other combo box with? For instance in combo box 1, if I choose city, it will list all cities? if I choose state, it will list only the states? If so, that shouldn't be too hard..... I have to do some real work for a bit, then I'll see if I can come up with what you want |
|
#9
| |||
| |||
| Yes as in your example... The 1st drop down will show the field names (I can hard code them if needed) After Update The 2nd Drop down needs to have ONLY the UNIQUE values from that field. So if you choose State the 2nd dropdown will have California, Illinois, Indiana, Ohio THANK YOU VERY MUCH.... |
|
#10
| ||||
| ||||
| You're right, it's easier to hard code the first combo box. I made mine 2 columns, the first column holding the number, the second the field name. I made the first column width 0 inches so it wouldn't display the number. It stores the number, not the field name. Then on afterupdate of the first combo box, I did a case statement... case 1 - make states visible case 2 - make region visible case 3 - make cities visible Here is the sample..... it's really not very difficult after you see what I've done here. |
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [ASP/VBScript] Using Dropdown List Value in Database SQL Query | richyrich | Code Samples | 0 | April 2nd, 2008 10:05 AM |
LinkBacks (?)
LinkBack to this Thread: http://www.developerbarn.com/microsoft-access/174-sql-vba-query.html | ||||
| Posted By | For | Type | Date | |
| Using 2 combo boxes in conjunction with each other - ASP Free | This thread | Refback | May 21st, 2008 11:20 AM | |