Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21136

Run-time Error 3021, No Current Record, query string question.

$
0
0
I'm working with a few year old VB6 project, using Access 2000 tables.

When my query string is run against a couple tables, I get a 'No current record' error.

I believe now I have a syntax problem in my query string's WHERE , as running a query in Access yields the desired result.

Access query SQL - OK:
Code:

SELECT tblEventPage.InputID, tblInputs.Card_No, tblInputs.Bank_No, tblInputs.Bit_No, tblInputs.Label, tblGroups.Group, tblInputs.Page, tblPreferences.KeyRecip, tblRecipients.Email
FROM tblGroups INNER JOIN (tblInputs INNER JOIN tblEventPage ON tblInputs.ID = tblEventPage.InputID) ON tblGroups.ID = tblInputs.Group, tblPreferences INNER JOIN tblRecipients ON tblPreferences.KeyRecip = tblRecipients.Recipient
WHERE (((tblInputs.Card_No)=[Card]) AND ((tblInputs.Bank_No)=[Bank]) AND ((tblInputs.Bit_No)=[Bit]));

This is my VB6 query string, with input view message box, so I know its receiving the criteria.
Code:

MsgBox "Card: " & Card & ", Bank: " & Bank & ", Bit: " & Bit '*** All OK ***

strSQL = "SELECT  tblEventPage.InputID, tblInputs.Card_No, tblInputs.Bank_No, tblInputs.Bit_No, tblInputs.Label, tblGroups.Group, tblInputs.Page, tblPreferences.KeyRecip, tblRecipients.Email " & _
"FROM tblGroups INNER JOIN (tblInputs INNER JOIN tblEventPage ON tblInputs.ID = tblEventPage.InputID) ON tblGroups.ID = tblInputs.Group, tblPreferences INNER JOIN tblRecipients " & _
"ON tblPreferences.KeyRecip = tblRecipients.Recipient " & _
"WHERE tblInputs.Card_No = " & Card & " AND tblInputs.Bank_No = " & Bank & " AND tblInputs.Bit_No = " & Bit & ";"
Set RSs = DB.OpenRecordset(strSQL)

pag = RSs!Page  'RSs.Fields("Page")  'Run-timer error 3021, No Current Record here (pag is empty).

Any guidence on my WHERE would be appreciated.

Viewing all articles
Browse latest Browse all 21136

Trending Articles