Hi.
I am tring to use the moduel to automatically fill in the field using the
current date and this function moduel.
As an example, the following line of code in the form's module would assign
today's date to a text box named txtJulianDate:
Me!txtJulianDate.Value = CDate2Julian(Date)
The problem I am having is tying the
module to the text field in Access.
It can be assigned during some event of the form or control. For example,
one may assign the value passed back by this function by using code such as
the following:
Private Sub JulianDateBtn_Click()
On Error GoTo ErrHandler
Me!txtJulianDate.Value = CDate2Julian(Me!txtSomeDate.Value)
Exit Sub
ErrHandler:
MsgBox "Error in JulianDateBtn_Click( )." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear
End Sub
.. . . where txtJulianDate is the name of the text box that the Julian Date
will be displayed, and txtSomeDate is the name of the text box that has a
Gregorian Date that needs the conversion. This value can be assigned with
the click of a button (named JulianDateBtn in the example above), or in some
other event of the form (such as the OnFormOpen( ) event), or in some control
event (such as the OnAfterUpdate( ) event of the text box with the Gregorian
Date).
HTH.
Gunny
See
http://www.QBuilt.com for all your database needs.
See
http://www.Access.QBuilt.com for Microsoft Access tips.
(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.