|
-
Jun 2nd, 2003, 08:12 AM
#1
Thread Starter
Lively Member
Help with Recordset**RESOLVED**
Hi
Using DAO on a Access97 Database I'm using the following statement to open a recordset.
Code:
Set RstCust = Dbs2.OpenRecordset("select * from [sales orders] where customerid = '" & RstEnq![CustID] & "'")
It gives me the runtime error 3021 no current record surely I can select a recordset theat has no records then test for records afterwards. I need to cycle through a list of customers and update there records, there maybe records to update and there may not be but I thought I could open the recordset then check for EF and BOF afterwards. Can anyone see anything wrong with my statement because I can't and I have a very similar recordset statement earlier in the procedure and it works fine
TIA
JFK
Last edited by JFK; Jun 5th, 2003 at 04:35 AM.
-
Jun 3rd, 2003, 03:04 PM
#2
PowerPoster
Somwhow, it seems to me that you are missing a quote at the end of the SQL statement.
-
Jun 4th, 2003, 12:25 PM
#3
Hyperactive Member
You generally get that error when there are no records in the table at all. The index for the table hasn't been initialized in that case.
-
Jun 5th, 2003, 02:16 AM
#4
Thread Starter
Lively Member
Ephisians there are over 20000 records in the table, just maybe none that the recordset could return.
Pasvorto which quote and where?
thanks
JFK
-
Jun 5th, 2003, 03:54 AM
#5
Re: Help with Recordset
Originally posted by JFK
Code:
Set RstCust = Dbs2.OpenRecordset("select * from [sales orders] where customerid = '" & RstEnq("CustID") & "'")
Customer id is text ??
If so then that should work fine.
You just need to check the EOF property of the recordset afterwards. If its not true, do the processing...
Vince
Last edited by Ecniv; Jun 5th, 2003 at 04:07 AM.
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Jun 5th, 2003, 04:08 AM
#6
Thread Starter
Lively Member
Ecniv
Customer id is text but I still get the error message, I don't understand why as usually I get the chance to check BOF and EOF but when I run this it stops at the line setting the recordset.
I checked that the database that the table is in is being opened and it is (I assume it is as the .ldb file is created when I use the open database method) so getting a bit frustrated now.
thanks
JFK
-
Jun 5th, 2003, 04:20 AM
#7
The rstEnq("custid") is not on a record then.
Do you check that there is a record there first??
Vince
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Jun 5th, 2003, 04:34 AM
#8
Thread Starter
Lively Member
Thanks ecniv although I did check that Rstenq had records I hadn't checked that it had gone EOf from previous operations.
many thanks
JFK
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
|