G
Guest
I have a table called tblCourses. In it are 2 fields called strCourseCode and
strCourseNum. Both of them are Text fields. In one of my forms to add
courses, I tried to check for duplicate strCourseCode and strCourseNum
combinations when the Save button is clicked. The code looks like this:
Dim rs As DAO.Recordset
Dim db As DAO.Database
Set db = CurrentDb
Set rs = db.OpenRecordset("tblCourses", dbOpenDynaset)
rs.FindFirst "[strCourseCode] = " & Me.[cboCourseCode] & " AND
[strCourseNum] _ = " & Me.[strCourseNum] & ""
If Not rs.NoMatch Then
MsgBox "The Course Code combination already exists!"
But when I clicked on the Save button, I got his error instead:
"The Microsoft Jet database does not recognize 'BIBBH' as a valid field name
or expression."
BIBBH was a course code I added to simulate a duplicate entry. Any advise is
appreciated. Thanks.
ck
strCourseNum. Both of them are Text fields. In one of my forms to add
courses, I tried to check for duplicate strCourseCode and strCourseNum
combinations when the Save button is clicked. The code looks like this:
Dim rs As DAO.Recordset
Dim db As DAO.Database
Set db = CurrentDb
Set rs = db.OpenRecordset("tblCourses", dbOpenDynaset)
rs.FindFirst "[strCourseCode] = " & Me.[cboCourseCode] & " AND
[strCourseNum] _ = " & Me.[strCourseNum] & ""
If Not rs.NoMatch Then
MsgBox "The Course Code combination already exists!"
But when I clicked on the Save button, I got his error instead:
"The Microsoft Jet database does not recognize 'BIBBH' as a valid field name
or expression."
BIBBH was a course code I added to simulate a duplicate entry. Any advise is
appreciated. Thanks.
ck