G
Guest
I keep getting an error ("Compile Error: Method or data member not found")
when I compile the following code:
Private Sub CopyRecord_Click()
On Error GoTo Err_CopyRecord_Click
Dim stDocName As String
Dim Query As QueryDef
Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("Error Report Table")
DoCmd.SetWarnings False 'Only way I could eliminate a message from a
macro.
DoCmd.Echo False
Me!Department.Visible = True
Me![Error Entered By].Visible = True
stDocName = "CopyToNewRecordQuery"
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.SetValue Query![Error Entered By].Value = CurrentUser()
DoCmd.Requery
Me!Department.Visible = False
Me![Error Entered By].Visible = False
rst.Bookmark = rst.LastModifed
DoCmd.SetWarnings True
DoCmd.Echo True
Exit_CopyRecord_Click:
Exit Sub
Err_CopyRecord_Click:
MsgBox Err.Description
Resume Exit_CopyRecord_Click
End Sub
After I click OK, .LastModified is highlighted. Is this a missing reference
problem? If so, what library is this in? I have tried several but I have
been unable to figure out which library will make the above compile error go
away. I have searched through the newsgroups, but have not found anything
that suggests libraries to try. I am extremely new to the world of VBA, and
have had no formal training. Any help would be appreciated.
Thanks,
Tiffany
when I compile the following code:
Private Sub CopyRecord_Click()
On Error GoTo Err_CopyRecord_Click
Dim stDocName As String
Dim Query As QueryDef
Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("Error Report Table")
DoCmd.SetWarnings False 'Only way I could eliminate a message from a
macro.
DoCmd.Echo False
Me!Department.Visible = True
Me![Error Entered By].Visible = True
stDocName = "CopyToNewRecordQuery"
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.SetValue Query![Error Entered By].Value = CurrentUser()
DoCmd.Requery
Me!Department.Visible = False
Me![Error Entered By].Visible = False
rst.Bookmark = rst.LastModifed
DoCmd.SetWarnings True
DoCmd.Echo True
Exit_CopyRecord_Click:
Exit Sub
Err_CopyRecord_Click:
MsgBox Err.Description
Resume Exit_CopyRecord_Click
End Sub
After I click OK, .LastModified is highlighted. Is this a missing reference
problem? If so, what library is this in? I have tried several but I have
been unable to figure out which library will make the above compile error go
away. I have searched through the newsgroups, but have not found anything
that suggests libraries to try. I am extremely new to the world of VBA, and
have had no formal training. Any help would be appreciated.
Thanks,
Tiffany