|
-
Oct 5th, 2002, 11:04 AM
#1
Thread Starter
Lively Member
Basic SQL statement
I am trying to locate a single record from a table by using the statement
ado.recordsource = SELECT FROM ClientDetails WHERE ClientID =temp
Because ClientID is the primary key (and the variable temp contains the required ClientID number), I would expect the recordset to only return one record - except it doesn't. When searching through the result in debug, it seems to go through every record in the table.
What Am I doing wrong?
Last edited by darthy; Oct 5th, 2002 at 11:31 AM.
-
Oct 5th, 2002, 12:06 PM
#2
Lively Member
Is "ado" a datacontrol or what? n where are you assigning the value for variable temp? can you post your piece of code.
Your attitude determines your altitude!!!
-
Oct 5th, 2002, 05:27 PM
#3
PowerPoster
Well
VB Code:
ado.recordsource = SELECT * FROM ClientDetails WHERE ClientID = '" & temp & "'"
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Oct 6th, 2002, 01:38 PM
#4
Thread Starter
Lively Member
When I use the code mentioned above I get Error - Expected Expression
Code:
Ado.RecordSource = SELECT * FROM Client WHERE ClientID = '" & temp & "'""
But when I put extra quotes ie
Code:
Ado.RecordSource = "SELECT * FROM Client WHERE ClientID = '" & temp & "'"""
The Expected expression goes away but then I get a Error in FROM Clause
Any Ideas?
-
Oct 6th, 2002, 01:40 PM
#5
PowerPoster
Well
VB Code:
ado.recordsource = "SELECT * FROM ClientDetails WHERE
ClientID = '" & temp & "'"
he quote needs to be in front of SELECT
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Oct 6th, 2002, 01:44 PM
#6
Thread Starter
Lively Member
Quote is in front of select NOW (my mistake when entering code inside tags)
But still getting the same error
In debug it is when I use the refresh method when the error occurs. Could that be something to with it.
It comes up with Method refresh of ADO failed
Any ideas?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|