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!

Setting Default values in a Subform

Status
Not open for further replies.

IanLo

Technical User
Aug 7, 2003
3
0
0
GB
How can I set the current field in a subform (table view) to pick up the value of the same field in the previous record, as the default value - but still have the facility to change it to a different value if required.

Thanks in anticipation!!

Ian
 
Forms!subformname.OpenArgs

Have a look at OpenArgs in help, that should solve things for you.

~amcodah()
 
Thanks for your reply.
I don't think this is what I'm after. For Example - When I have filled in the first record in a subform and moved to the second record, I want the second record to autofill with certain values from the first record, but still be able to change them if necessary, as I complete the rest of the record.

Thanks again!
 
Yes, that's what I pointed out to you. You can send variables through the OpenArgs method.

But yet a simpler method of solving this, since it seems like you'r not an experienced VBA user.. Would be to create a dummyform which is based on a query that gets data from the latest record. Then do this


Private Sub Form_Load()
DoCmd.OpenForm frm_dummyform, , , , acFormReadOnly, acHidden
End Sub

Private Sub Form_AfterInsert()
Me.frm_dummyform.Requery
End Sub

Private Sub Form_Load()
Me.Field1 = Forms!frm_dummyform!Field1
Me.Field2 = Forms!frm_dummyform!Field2
.. and so on ..
End Sub


I see no reason why that shouldn't work. Hope it helps.
~amcodah()
 
You've sussed me!!! You're right - I've started playing with Access to try and learn a little more - but have a long way to go. Thanks for your help - and patience!!!

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top