Null error 94 (1 Viewer)

freddykat

Registered User.
Local time
Today, 22:28
Joined
Jul 4, 2015
Messages
33
Hi everybody Im trying to pass a value from a form to a table using this code
Code:
Call WriteLog("INSERIR PEÇA", Me.Texto694.Value)

I tried and access is running fine with the label "INSERIR PEÇA" however Im trying to chose a auto number in text box named "Texto694".
Does anyone know what Im doing wrong and get a error?

Help pzz
 

Cronk

Registered User.
Local time
Tomorrow, 07:28
Joined
Jul 4, 2013
Messages
2,774
No, I have no idea what you are doing wrong, except in not giving any useful information.

I might have had an idea what you are doing wrong, if you provided the code in the subroutine WriteLog.

However it just might be that the text box has a null value and your code can't handle this.
 

Royce

Access Developer
Local time
Today, 16:28
Joined
Nov 8, 2012
Messages
99
As there is not enough information to really tell what's going on, try wrapping the value in Nz()

Nz(Me.Texto694.Value,0)
 

GinaWhipp

AWF VIP
Local time
Today, 17:28
Joined
Jun 21, 2011
Messages
5,899
Hmm, too little info...

If you are using in code then you might need...

Code:
 If Me.NewRecord Then
     DoCmd.CancelEvent
Else
      Call WriteLog("INSERIR PEÇA", Me.Texto694.Value)
 End If
 

freddykat

Registered User.
Local time
Today, 22:28
Joined
Jul 4, 2015
Messages
33
As there is not enough information to really tell what's going on, try wrapping the value in Nz()

Nz(Me.Texto694.Value,0)

I tryed you soluction but didnt work for me.
I need to retreive the value of the textbox694, with your soluction it returns only 0.

Any ideas?
 

GinaWhipp

AWF VIP
Local time
Today, 17:28
Joined
Jun 21, 2011
Messages
5,899
Please post the code for *WriteLog* as it looks like that is where the issue lies.
 

freddykat

Registered User.
Local time
Today, 22:28
Joined
Jul 4, 2015
Messages
33
Please post the code for *WriteLog* as it looks like that is where the issue lies.

The code for writeLog is
Code:
Private Sub Comando56_Click()
'Comando para novo registo
DoCmd.GoToRecord , , acNewRec
'Comando de Log de actividade
On Error Resume Next
Call WriteLog("INSERIR PEÇA", Nz(Me.Texto694.Value, 0))

The module that writes on log

Code:
Function WriteLog(strEvent As String, strProcess As String)
    Dim dbs As DAO.Database
    Dim rst As DAO.Recordset
    
    Set dbs = CurrentDb()
    Set rst = dbs.TableDefs("tblLog").OpenRecordset
    With rst
    .AddNew
    !LogEvent = strEvent
    !LogProcess = strProcess
    .Update
    .Close
    End With
    Set rst = Nothing
    Set dbs = Nothing
    
End Function
 

Royce

Access Developer
Local time
Today, 16:28
Joined
Nov 8, 2012
Messages
99
You have Texto694 in the code and TextBox694 in your reply. Which is it?

Is the line "Option Explicit" at the top of the code file? (You should always turn it on as it will prevent hours of frustration with typos.)
 

Users who are viewing this thread

Top Bottom