Jump to content
Sign in to follow this  
Rota

<Select> SQL ERROR in ACCESS

Recommended Posts

Rota

Hi Buddies,

I am going crazy about one SQL error in ACCESS, please help on below:

test.zip

I attached 3 different forms to open a "select *" sql from a Access file, while it always give a open error, for example:

$oRec.Open ("SELECT * FROM " & $adTable & " Where " & $adCol & " = " & $Find , $oADO)

$oRec.Open ("SELECT * FROM " & $adTable & " Where " & $adCol & " = " & $Find , $oADO)^ ERROR

I have no idea how this come... please help.

Thanks a ton.

Share this post


Link to post
Share on other sites
Rota

Any one in help for this SQL problem...

:)

Share this post


Link to post
Share on other sites
PsaltyDS

Hi Buddies,

I am going crazy about one SQL error in ACCESS, please help on below:

test.zip

I attached 3 different forms to open a "select *" sql from a Access file, while it always give a open error, for example:

$oRec.Open ("SELECT * FROM " & $adTable & " Where " & $adCol & " = " & $Find , $oADO)

$oRec.Open ("SELECT * FROM " & $adTable & " Where " & $adCol & " = " & $Find , $oADO)^ ERROR

I have no idea how this come... please help.

Thanks a ton.

I would help if you posted the actual error, vice just the quoted line. Did it say something like "requires an object"? Did you test IsObj($oRec) before trying to use it?

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Rota

Thanks PsaltyDS,

Yes, of course I used IsObj($oRec) in one of my searching function, could you please look in my attachment which I prepared 3 sample as well as my sample database, while 2 of them were totally not working in my pc, another one worked in mine but not in other pc.

Share this post


Link to post
Share on other sites
PsaltyDS

Thanks PsaltyDS,

Yes, of course I used IsObj($oRec) in one of my searching function, could you please look in my attachment which I prepared 3 sample as well as my sample database, while 2 of them were totally not working in my pc, another one worked in mine but not in other pc.

If I think of it when I'm not in Windows-land I'll crack it open and take a look, but I don't usually work with untrusted downloads from the forums. It would help if you could just post plain text info here.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
DaRam

It really helps ( :) ) that you do not include the include - #include<ACcess.au3>

Since adCol="txt1", I presume this is a Text data type column/field.

Try:

$oRec.Open ("SELECT * FROM [" & $adTable & "] WHERE [" & $adCol & "] = '" & $Find & "'", $oADO)

Or Just:

$oRec.Open ("SELECT * FROM " & $adTable & " WHERE " & $adCol & " = '" & $Find & "'", $oADO)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×