D
Dennis
Hi,
I'm on Access 2003 on XP Pro w sp3.
I have the following SQL statement:
Set dbCur = CurrentDb
strSQL = "Select min([DoorPrizeNo]) AS NewDoorPrizeNo"
strSQL = strSQL & " FROM qrytblMailingList"
strSQL = strSQL & " WHERE (((MemType) = 'MT-D')) Or (((MemberTerm) =
'MTR-E'))"
Set rstNC = dbCur.OpenRecordset(strSQL, dbOpenDynaset, dbReadOnly)
It is working fine. I know this because I copied the actual SQL statement
and pasted it into the Design New Query and ran it and it works fine.
The only issues is if there is no records that meet the criteria the SQL
statement still returns one record that is NULL. If there is a record that
meets the criteria, the SQL statement also returns one record that has a
value in the NewDoorPrize No field.
In both cases (fails or works) rstNC.RecordCount is equal to 1. I would
have expected 0 if it failed and 1 if it worked? To determine if I have a
record, I'm testing "IsNull(rstNC!NewDoorPrizeNo)" instead of
newNC.RecordCount.
Why does it return a null record is the SQL failed?
I'm on Access 2003 on XP Pro w sp3.
I have the following SQL statement:
Set dbCur = CurrentDb
strSQL = "Select min([DoorPrizeNo]) AS NewDoorPrizeNo"
strSQL = strSQL & " FROM qrytblMailingList"
strSQL = strSQL & " WHERE (((MemType) = 'MT-D')) Or (((MemberTerm) =
'MTR-E'))"
Set rstNC = dbCur.OpenRecordset(strSQL, dbOpenDynaset, dbReadOnly)
It is working fine. I know this because I copied the actual SQL statement
and pasted it into the Design New Query and ran it and it works fine.
The only issues is if there is no records that meet the criteria the SQL
statement still returns one record that is NULL. If there is a record that
meets the criteria, the SQL statement also returns one record that has a
value in the NewDoorPrize No field.
In both cases (fails or works) rstNC.RecordCount is equal to 1. I would
have expected 0 if it failed and 1 if it worked? To determine if I have a
record, I'm testing "IsNull(rstNC!NewDoorPrizeNo)" instead of
newNC.RecordCount.
Why does it return a null record is the SQL failed?