PDA

View Full Version : Excel VBS SQL Code Problem



brucel_SA
02-11-2008, 01:45 AM
Hi i am trying to get arecord back from the database specificly the last recort i am using this SQL code.



SQL = "Select [amt] from tblrecon]" & _
"Where [ID]= (Select Max[ID] From [tblrecon]"




But i am getting an automation error

thank you

Bob Phillips
02-11-2008, 02:33 AM
Bit difficult without the whole coide, but you might at least need another space



SQL = "Select [amt] from tblrecon] " & _
"Where [ID]= (Select Max[ID] From [tblrecon]"

anandbohra
02-11-2008, 03:09 AM
I found these brackets issue like opening is there closing is not there & so on

SQL = "Select [amt] from tblrecon] " & _
"Where [ID]= (Select Max[ID] From [tblrecon]"

The corrected one as per me is
SQL = "Select [amt] from tblrecon " & _
"Where [ID]= (Select Max[ID] From [tblrecon])"

Bob Phillips
02-11-2008, 03:49 AM
oops missed the bracket