M
MarkS
Hi,
I use this query in Access
Select Max([Version]) As VerionNo From [Gen - ES Sites] Where [Scheme] = "REC"
And it works fine
In Excel VBA I use this code
'Provider = Microsoft Access
ACCESSConnect = "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=S:\STAR\risk\ECO\ECO.mdb;"
' Create Connection Object and open it on files.MDB
Set connMelbourne = New ADODB.Connection
connMelbourne.ConnectionTimeout = 60
connMelbourne.ConnectionString = ACCESSConnect
connMelbourne.Open
connMelbourne.CommandTimeout = 620
' Get the latest version
sSql = "Select Max(Version) As VerionNo " & _
"From [Gen - ES Sites] " & _
"Where Scheme = " & Chr(34) & "REC" & Chr(34)
' Run Query and load record set
rsADO.Open sSql, connMelbourne, adOpenStatic, adLockReadOnly
and at the last line I get this error
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
I have tried putting square brackers around both column names, unfortunatly
that didn't work
Has anyone got any sugestion
Thanks MarkS
I use this query in Access
Select Max([Version]) As VerionNo From [Gen - ES Sites] Where [Scheme] = "REC"
And it works fine
In Excel VBA I use this code
'Provider = Microsoft Access
ACCESSConnect = "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=S:\STAR\risk\ECO\ECO.mdb;"
' Create Connection Object and open it on files.MDB
Set connMelbourne = New ADODB.Connection
connMelbourne.ConnectionTimeout = 60
connMelbourne.ConnectionString = ACCESSConnect
connMelbourne.Open
connMelbourne.CommandTimeout = 620
' Get the latest version
sSql = "Select Max(Version) As VerionNo " & _
"From [Gen - ES Sites] " & _
"Where Scheme = " & Chr(34) & "REC" & Chr(34)
' Run Query and load record set
rsADO.Open sSql, connMelbourne, adOpenStatic, adLockReadOnly
and at the last line I get this error
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
I have tried putting square brackers around both column names, unfortunatly
that didn't work
Has anyone got any sugestion
Thanks MarkS