Carrying Date Forward to New Record 
Author Message
 Carrying Date Forward to New Record

I have a data entry form that I am trying to make as easy to use as
possible. A lot of field entries are the same among the various records so I
want these values to remain persistent as each new record is added.

I can accomplish this by setting the default value for a control bound to a
particular field each time a record is added.  This appears to work fine for
all fields except the one involving the date/time datatype.

When the user enters the date for a new record, the default value is set by
the following code in the after update event of the control:

    txtDate.DefaultValue = txtDate.Value
    MsgBox txtDate.Value           ' diagnostic

The disgnostic message box displays the correct date.

In the form's after update event, I prompt the user if they want to add
another record. If "OK" the following code executes:

 If bytChoice = vbOK Then
    DoCmd.GoToRecord , , acNewRec
    MsgBox txtDate.Value  ' diagnostic
    cboSwimmer.SetFocus
  End If

At this point the diagnostic messgage box displays the value: 12:22.02 AM.

Does anyone have any idea why the value for the date would change?

Thanks
Dave



Fri, 15 Jun 2001 03:00:00 GMT  
 Carrying Date Forward to New Record
Hi David,

Try it like this

'******* Code Start *******
Private Sub HireDate_AfterUpdate()
Const conQ = """"
  With Me
    .HireDate.DefaultValue = conQ & _
        .HireDate.Value & conQ
  End With
End Sub
'****** Code End ********

HTH
--
Dev Ashish (Just my $.001)
---------------
The Access Web ( http://home.att.net/~dashish )
---------------


:I have a data entry form that I am trying to make as easy to use as
:possible. A lot of field entries are the same among the various records so
I
:want these values to remain persistent as each new record is added.
:
:I can accomplish this by setting the default value for a control bound to a
:particular field each time a record is added.  This appears to work fine
for
:all fields except the one involving the date/time datatype.
:
:When the user enters the date for a new record, the default value is set by
:the following code in the after update event of the control:
:
:    txtDate.DefaultValue = txtDate.Value
:    MsgBox txtDate.Value           ' diagnostic
:
:The disgnostic message box displays the correct date.
:
:In the form's after update event, I prompt the user if they want to add
:another record. If "OK" the following code executes:
:
: If bytChoice = vbOK Then
:    DoCmd.GoToRecord , , acNewRec
:    MsgBox txtDate.Value  ' diagnostic
:    cboSwimmer.SetFocus
:  End If
:
:At this point the diagnostic messgage box displays the value: 12:22.02 AM.
:
:Does anyone have any idea why the value for the date would change?
:
:Thanks
:Dave
:
:
:
:



Fri, 15 Jun 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Carrying information forward

2. Carrying a balance forward from Access2000

3. carry values forward

4. fields carried to wrong records

5. fields carried to wrong records

6. adding new records & new record

7. How do I carry a field value forward to the next record in another field?

8. re-using the same date for new records

9. Setting a forward date +5 and a standard time together

10. Browse Webfolder + files ... (Forward Dated by Poster)

11. Server Srcitping: Forward New Item

12. dates and times in record need to become records I think

 

 
Powered by phpBB® Forum Software