User defined type - not defined (1 Viewer)

Howlsta

Vampire Slayer
Local time
Today, 11:31
Joined
Jul 18, 2001
Messages
180
If I select the command button i get an error
in the code on line 2 (db As Database). Why is this? I based this on a similar example in a book, so thought it would be ok, it's probably simple. Can anyone help?

Private Sub cmdAdd_click()
Dim db As Database
Dim rstCourseModYr As Recordset

If IsNull(Me.CboModule) Or _
IsNull(Me.CboYr) Then

MsgBox "The module and year of course must be selected"

Else

Set db = CurrentDb()
Set rstCourseModYr = db.OpenRecordset("qryCourseModuleYr", _
dbOpenDynaset)
With rstCourseModYr
.AddNew
!CourseID = Me!CourseID
!NumberYr = Me!CboYr
!ModuleCode = Me!CboModule
.Update
.Bookmark = rstCourseModYr.lastModified
End With
Me!CourseIDF = rstCourseModYr!CourseIDF
 

D-Fresh

Registered User.
Local time
Today, 11:31
Joined
Jun 6, 2000
Messages
225
Well, check your references. First make sure no references are "MISSING". If so, then uncheck the box. Then check to make sure you have the DAO 3.x or 4.x library checked. Access the references sheet by openeing a module, then going to tools-->References... Hope this helps you...

Doug
 

Howlsta

Vampire Slayer
Local time
Today, 11:31
Joined
Jul 18, 2001
Messages
180
Thanx that worked but now it gets further down the code and says:
"Method or data member not found"

This occurs for the LastModified property. Maybe its because I haven't added any new records yet, but when I try to it still says the same. Do you know anything about this?
 

Users who are viewing this thread

Top Bottom