Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
My syntax is slightly wrong and having a look on the help file hasnt helped.
This works-------------------------------------------------------------------- Set rs = db.OpenRecordset("SELECT description FROM" & selectTable) How do i get this to work?--------------------------------------------------- Dim i As String i= "description" I have tried this - Set rs = db.OpenRecordset("SELECT" i " FROM" & selectTable) + this - Set rs = db.OpenRecordset("SELECT' i ' FROM" & selectTable) + this - Set rs = db.OpenRecordset("SELECT" & i " FROM" & selectTable) im sure the fix is very simple, thanks in advance -- -- Thanks Parkin_m |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Made it simpler to read below:
'This works Set rs = db.OpenRecordset("SELECT description FROM" & selectTable) 'Trying to get it so that i can put the column name from a variable Dim i As String i= "description" 'none of these work 'Set rs = db.OpenRecordset("SELECT" i " FROM" & selectTable) 'Set rs = db.OpenRecordset("SELECT' i ' FROM" & selectTable) 'Set rs = db.OpenRecordset("SELECT" & i " FROM" & selectTable) im sure the fix is very simple, thanks in advance |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Try Set rs = db.OpenRecordset("SELECT " & i & " FROM" & selectTable) hth Keith |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You need this:
Dim i As String i = "description" Set rs = db.OpenRecordset("SELECT " & i & " FROM " & selectTable) It won't matter, but I wouldn't pick i for the variable name as this is normally for an integer or long variable. Pick something like strField or sField. RBS "parkin_m" wrote in message ... Made it simpler to read below: 'This works Set rs = db.OpenRecordset("SELECT description FROM" & selectTable) 'Trying to get it so that i can put the column name from a variable Dim i As String i= "description" 'none of these work 'Set rs = db.OpenRecordset("SELECT" i " FROM" & selectTable) 'Set rs = db.OpenRecordset("SELECT' i ' FROM" & selectTable) 'Set rs = db.OpenRecordset("SELECT" & i " FROM" & selectTable) im sure the fix is very simple, thanks in advance |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hahaha. I really should of thought of that! (Silly adding strings!)
Thanks keith. -- -- Thanks Parkin_m "Keith74" wrote: Hi Try Set rs = db.OpenRecordset("SELECT " & i & " FROM" & selectTable) hth Keith |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
breaking a field out | Excel Worksheet Functions | |||
Breaking links | Excel Worksheet Functions | |||
breaking links | Excel Discussion (Misc queries) | |||
Hyperlinks keep breaking | Excel Worksheet Functions | |||
Breaking a UserForm | Excel Programming |