Rabu, 01 Februari 2012

RE: [MS_AccessPros] New record is causing a Null error for unbound text field

 

Arthur-

Do this:

Private Sub Form_Current()
Me.Caption = "Cheyenne River Housing Authority"

If Not Me.NewRecord Then
Me.txtElaspedTime = GetElapsedTime([EndTime] - [StartTime])
End If

End Sub

John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
http://www.viescas.com/
(Lahaina, HI)

-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Art
Sent: Wednesday, February 01, 2012 1:19 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] New record is causing a Null error for unbound text
field

I have a unbound textbox that is populated when the following code runs:

Private Sub EndTime_AfterUpdate()
Me.txtElaspedTime = GetElapsedTime([EndTime] - [StartTime])
End Sub

I also have this statement in the load and current events:

Private Sub Form_Current()
Me.Caption = "Cheyenne River Housing Authority"

Me.txtElaspedTime = GetElapsedTime([EndTime] - [StartTime])

End Sub

Private Sub Form_Load()
If Me.NewRecord Then
Me.UnitID = Me.OpenArgs

End If
Me.txtElaspedTime = GetElapsedTime([EndTime] - [StartTime])
End Sub

THe issue arises when I move onto a new record, then issues a "Invalid use of
nulls" error.

It makes since to me because the Endtime and Starttime are not populated yet in
a new record but ho do I correct it?

Thank you,

Arthur Lorenzini

------------------------------------

Yahoo! Groups Links

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar