Lrn2Code
Registered User.
- Local time
- Today, 18:48
- Joined
- Dec 8, 2008
- Messages
- 56
Hi! I'm relatively new to the programming world and definitely need some help.
Am working on an application and trying to call a recordset to compare data that was entered into a form to data that is in a table making sure the "new" entry won't be a duplicate of what's already in the table. I keep getting strange errors that I can't figure out - one is the 3075 error and another is "Object variable or with block variable not set".
I have no clue what this means but I cannot get my "set rst =" phrase to actually work. The rst variable keeps showing up as "= nothing". And once it hits the set rst = dbs.OpenRecordset(strSQL) the program jumps down to the error line.
My code is pasted below - any guidance you can provide is greatly appreciated, and if you need more information just let me know. Thank you!
strSQL = "Select * from tblschoolclasses where coursename = '" & strName & "' and coursecat = '" & strcoursecat & "' and POSID = '" & strPSID & ""
Set rst = dbs.OpenRecordset(strSQL)
If rst.RecordCount > 0 Then
MsgBox "This course name already exists at this school."
Exit Sub
End If
Am working on an application and trying to call a recordset to compare data that was entered into a form to data that is in a table making sure the "new" entry won't be a duplicate of what's already in the table. I keep getting strange errors that I can't figure out - one is the 3075 error and another is "Object variable or with block variable not set".
I have no clue what this means but I cannot get my "set rst =" phrase to actually work. The rst variable keeps showing up as "= nothing". And once it hits the set rst = dbs.OpenRecordset(strSQL) the program jumps down to the error line.
My code is pasted below - any guidance you can provide is greatly appreciated, and if you need more information just let me know. Thank you!
strSQL = "Select * from tblschoolclasses where coursename = '" & strName & "' and coursecat = '" & strcoursecat & "' and POSID = '" & strPSID & ""
Set rst = dbs.OpenRecordset(strSQL)
If rst.RecordCount > 0 Then
MsgBox "This course name already exists at this school."
Exit Sub
End If