Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use date entered from previous record 1

Status
Not open for further replies.

bigtwig

IS-IT--Management
Oct 20, 2002
18
0
0
US
Hi all,
I'm trying to set as the default date for the second record on in a form to be equal to whatever date was entered in the previous record.
I have someone who enters a week's worth of work schedules at a time and has to re-enter the date everytime and using Date() as the default date isn't helpful.
Any thoughts on doing this?
Thanks,
Mike
 
I go to the Events tab for that field and create this small sub (plus error trapping) so, if my variable is WorkDate, it is:

Private Sub Form_AfterUpdate()
Me.Controls("WorkDate").DefaultValue = """" & Me.Controls("WorkDate").Value & """"

End Sub


This will set the DefaultValue for the next record using this one?
Thanks,
Mike
 
No, I can't get it to work. The form name is 'frmWorkSchedule' - The field is a text box called 'BillDate'

I've tried:
a) Me.Controls("BillDate").DefaultValue=""""&Me.Controls("BillDate").Value&""""

It seems it doesn't like the .DefaultValue because it doesn't come up for me automatically as a property.

b) Me.Controls(Forms!frmWorkSchedule!BillDate.DefaultValue)=""""&Me.Controls(Forms!frmWorkSchedule!BillDate.Value)&""""

I get a run-time error 2458.

Other suggestions?
Thanks,
Mike
 
Do you have spaces in your code around the &?
Code:
Me.Controls("BillDate").DefaultValue="""" & Me.Controls("BillDate").Value & """"

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
That was it, and not having quotes around BillDate. Thanks!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top