G
Guest
My SQL table has two keys: Composite Name and Date. A user cannot add a
record if the name and date already exist in the database.
How should the code be written to query on two keys at the same time?
Set rst = db.OpenRecordset("SELECT * FROM dbo_Tbl_MonthlyData" & _
"WHERE Composite_Name = " & QUOTE & strCompositeName & QUOTE) & _
Month = " & QUOTE & varMonth & QUOTE)"
If strCompositeName and varMonth > 1 then
.... Msgbox: This record already exist....
record if the name and date already exist in the database.
How should the code be written to query on two keys at the same time?
Set rst = db.OpenRecordset("SELECT * FROM dbo_Tbl_MonthlyData" & _
"WHERE Composite_Name = " & QUOTE & strCompositeName & QUOTE) & _
Month = " & QUOTE & varMonth & QUOTE)"
If strCompositeName and varMonth > 1 then
.... Msgbox: This record already exist....