DAO Simple Question

G

Guest

I am attempting to import forms and code, I also need to
import the frm module. How do I do this?

I am trying to perform this routine and am receiving an
error "User-defined type not defined" at the first DIM
statement.

'*** Actual code ***
Private Sub Form_Load()
Dim db As DAO.Database
Dim snp As DAO.Recordset
Dim msg As String

Set db = CurrentDb
Set snp = db.OpenRecordset("Settings", dbOpenSnapshot)
If snp![logoff] Then
msg = "The database is closed for updating" & vbCrLf &
vbCrLf & "Please try later."
MsgBox msg
Application.Quit
End If
DoCmd.Hourglass False

End Sub
'*** End of code ****
 
D

Dirk Goldgar

I am attempting to import forms and code, I also need to
import the frm module. How do I do this?

I am trying to perform this routine and am receiving an
error "User-defined type not defined" at the first DIM
statement.

'*** Actual code ***
Private Sub Form_Load()
Dim db As DAO.Database
Dim snp As DAO.Recordset
Dim msg As String

Set db = CurrentDb
Set snp = db.OpenRecordset("Settings", dbOpenSnapshot)
If snp![logoff] Then
msg = "The database is closed for updating" & vbCrLf &
vbCrLf & "Please try later."
MsgBox msg
Application.Quit
End If
DoCmd.Hourglass False

End Sub
'*** End of code ****

You need to set a reference to the DAO object library. In the VB Editor
environment, click Tools -> References..., look down the list for
"Microsoft DAO 3.6 Object Library", and put a check mark in the box next
to it.

I suggest that you include the line

snp.Close

before the line
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top