Working History

alastair69

Registered User.
Local time
Today, 13:02
Joined
Dec 21, 2004
Messages
560
Hello People,

I hope on this friday we are all feeling friendly and helpfull.

The code below is giving me an error of Object variable or With block variable not set (Error 91), on looking at the code i can see anything incorrect would you be able to point me in the right direction for help on this.

Code i am using is:-
Private Sub cmdEmail_Click()
Dim x, dbs As Database, strReportNo As String, strUser As String, strUpdateSQL As String

'x = fHandleFile("mailto:" & Me!ContactEmail, WIN_NORMAL)
strUser = User()
strReportNo = Me.ContactID

strUpdateSQL = "INSERT INTO [JT History] ( ClientID, HistoryDate, Description, UserID ) " & _
"VALUES ( '" & strReportNo & "', '" & Now() & "', 'E-Mailed', '" & strUser & "');"

dbs.Execute strUpdateSQL

End Sub

Please help if you can

Thanks

Alastair

UPDATE

******************************* RESOLVED THANKS TO ANTOMACK ***********************************
 
Last edited:
You have not set the dbs variable to anything so it cannot find the database object

Put the following line before the dbs.execute line
Set db = CurrentDb
 
Fixed & Working

THANK YOU VERY MUCH antomack
 

Users who are viewing this thread

Back
Top Bottom