UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Invalid Use Of Null, Access 2016    
 
   
mike60smart
post Jun 30 2020, 05:54 AM
Post#1


UtterAccess VIP
Posts: 14,034
Joined: 6-June 05
From: Dunbar,Scotland


Hi Everyone

I have the following Code in the ONCurrent Event of a Nested Subform

When I move yo a New Record on the Subform I get the following Error:-

Attached File  error.JPG ( 13.63K )Number of downloads: 0


This is expected as at this moment the User has not yet selected an Option from a Combobox to populate the New record PrimaryKey Control.

Is it possible to eliminate this error message?

Any help appreciated.

CODE
Private Sub Form_Current()

10        On Error GoTo Form_Current_Error
      Dim lngTAOCID As Long
20    lngTAOCID = Me.cboTAOC.Column(0)

30    TempVars.Add "TAOCID", lngTAOCID
          
40        On Error GoTo 0
50        Exit Sub

Form_Current_Error:

60        MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Form_Current, line " & Erl & "."

End Sub

--------------------
Hope this helps?

Mike

Get happiness out of your work or you may never know what happiness is.

Go to the top of the page
 
projecttoday
post Jun 30 2020, 07:00 AM
Post#2


UtterAccess VIP
Posts: 12,397
Joined: 10-February 04
From: South Charleston, WV


CODE
20    lngTAOCID = Nz(Me.cboTAOC.Column(0), 0)

--------------------
Robert Crouser
Go to the top of the page
 
mike60smart
post Jun 30 2020, 08:53 AM
Post#3


UtterAccess VIP
Posts: 14,034
Joined: 6-June 05
From: Dunbar,Scotland


Hi Robert

Many thanks that fixes that

cheers.gif

--------------------
Hope this helps?

Mike

Get happiness out of your work or you may never know what happiness is.

Go to the top of the page
 
projecttoday
post Jun 30 2020, 09:56 AM
Post#4


UtterAccess VIP
Posts: 12,397
Joined: 10-February 04
From: South Charleston, WV


You're welcome.

--------------------
Robert Crouser
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    11th July 2020 - 03:27 AM