Question Run Time Error 94: Invalid use of Null

babui386

Registered User.
Local time
Today, 09:41
Joined
Feb 25, 2013
Messages
22
Hi,

I am new to MS Access, just started learning watching youtube videos.

I have created a form for customer and where company logo I am using logo images using path in table and using vb in form, uptill its working fine.

Private Sub Form_Current()
logoImage.Picture = CompanyLogo
End Sub

I am getting Run Time Error 94: Invalid use of Null, when it reaches to last row where it is empty, I think I need to use a IF dataset NULL condition, for this. Please anyone could help me / point me how I can stop getting this error?

Regards

Babui386
 
Try:
Code:
Private Sub Form_Current()
If Not Me.NewRecord Then
  logoImage.Picture = CompanyLogo
End Sub
 
Hi,

Thanks for quick help, it worked fine.

But can I add a msg box - right now its showing "You can't go to the specified record" , can I add to something else?
 
Hi Bob,

I was just thinking to add a msg when user is at last row, and row is empty, it can say something - "Record is empty"
 
Hi Bob,

I was just thinking to add a msg when user is at last row, and row is empty, it can say something - "Record is empty"
That dosen't really answer the question that I asked. The message "You can't go to the specified record" is often caused by code in the On Click event of a button that has code to move on to the next record. The error that causes the message to be displayed can be caught and changed.
 
Hi Bob,

Sorry,

i have navigation buttons, when you click next (end of records) - it shows that msg, I was thinking to change the msg into something nice....
 
Below is an example of the code you might use. In this example the button is called "Command11"
Code:
Private Sub Command11_Click()
On Error GoTo Err_Command11_Click

    DoCmd.GoToRecord , , acNext
Exit_Command11_Click:
    Exit Sub
Err_Command11_Click:
  If Err.Number = 2105 Then
    MsgBox "Your msg"
    Resume Exit_Command11_Click
  Else
    MsgBox "Error Num " & Err.Number & " " & Err.Description
    Resume Exit_Command11_Click
  End If
    
End Sub
 
Hi Bob,

Many thanks, I will try this, hope I will be able to make it...

Really appreciated your help,

ALWAYS LEARNING....

Babui386
 

Users who are viewing this thread

Back
Top Bottom