G
Guest
Can anyone help? I'm getting a runtime error 3131 in the "set masternum =
...." and i just dont see how i can be getting that error. secondly, for the
findfirst criteria is kind of giving me the same error. it doesnt like the
syntax. to me logically i see that it would work but then again im relativaly
new to the recordset area so if anyone could help me that would be great.
also if you have any other ideas that would be great also. thankyou
Set storenum = CurrentDb.OpenRecordset("SELECT SVNum FROM
tblSVNum;", dbOpenDynaset) 'Assign tblSVNumm to recordset
Set upcnum = CurrentDb.OpenRecordset("SELECT UPCCase FROM tblUPCs;",
dbOpenDynaset) 'Assign tblUPC to recordset
Set masternum = CurrentDb.OpenRecordset("SELECT CustNbr, UPCCase
FROM Sara Lee Master;", dbOpenDynaset) 'Assign Sara Lee Master to recordset
Set final = CurrentDb.OpenRecordset("Final VOIDs", dbOpenDynaset)
storenum.MoveFirst
upcnum.MoveFirst
masternum.MoveFirst
Do Until storenum.EOF
num = storenum!SVNum
Do Until upcnum.EOF
upc = upcnum!UPCCase
Do Until masternum.EOF
criteria = "[CustNbr] = '" & num & "' AND [UPCCase] = '"
& upc & "'"
masternum.FindFirst (criteria)
If masternum.NoMatch() Then
final.AddNew
final!num = num
final!case = UPCCase
final.Update
End If
masternum.MoveNext
Loop
upcnum.MoveNext
Loop
storenum.MoveNext
Loop
storenum.Close
upcnum.Close
masternum.Close
MsgBox "Operation was a success! " & final.RecordCount & " Records
where found and recorded.", vbInformation, "Information"
final.Close
...." and i just dont see how i can be getting that error. secondly, for the
findfirst criteria is kind of giving me the same error. it doesnt like the
syntax. to me logically i see that it would work but then again im relativaly
new to the recordset area so if anyone could help me that would be great.
also if you have any other ideas that would be great also. thankyou
Set storenum = CurrentDb.OpenRecordset("SELECT SVNum FROM
tblSVNum;", dbOpenDynaset) 'Assign tblSVNumm to recordset
Set upcnum = CurrentDb.OpenRecordset("SELECT UPCCase FROM tblUPCs;",
dbOpenDynaset) 'Assign tblUPC to recordset
Set masternum = CurrentDb.OpenRecordset("SELECT CustNbr, UPCCase
FROM Sara Lee Master;", dbOpenDynaset) 'Assign Sara Lee Master to recordset
Set final = CurrentDb.OpenRecordset("Final VOIDs", dbOpenDynaset)
storenum.MoveFirst
upcnum.MoveFirst
masternum.MoveFirst
Do Until storenum.EOF
num = storenum!SVNum
Do Until upcnum.EOF
upc = upcnum!UPCCase
Do Until masternum.EOF
criteria = "[CustNbr] = '" & num & "' AND [UPCCase] = '"
& upc & "'"
masternum.FindFirst (criteria)
If masternum.NoMatch() Then
final.AddNew
final!num = num
final!case = UPCCase
final.Update
End If
masternum.MoveNext
Loop
upcnum.MoveNext
Loop
storenum.MoveNext
Loop
storenum.Close
upcnum.Close
masternum.Close
MsgBox "Operation was a success! " & final.RecordCount & " Records
where found and recorded.", vbInformation, "Information"
final.Close