Fill values from previous record on double click

carahorse

Registered User.
Local time
Today, 08:54
Joined
Apr 1, 2013
Messages
36
Hi I have a Contacts subform and would like to be able to double click to fill addresses, and details from the previous row...every person in our database even those living at the same address needs thier own record.. and since we only need to fill up to 5 records and review them, double clicking on the first name to fill up the next row with the previous addres phone number ect would be grand.

I am assuming we could fill out the new Full Name and double click on it to get the previous record filled to the new one. Don't really want to work with a query unless needed, but I have a little vba understanding.. how do I code this to make it work?

Full_Name_Dbl_Click
getPreviousRecord.Address(-1)
getPreviousRecord.Phone Number(-1)
getPreviousRecord.City(-1)

Thanks for the help! This is for a horse rescue and kids program
 
In Datasheet view, you can select the entire record, press CTRL C to copy it tio clipboard, go to the new record and press CTRV to paste it.

Alternatively, make it so that double-clicking some control in the current record - which could be any record apart from the new record - saves the current values into some variables, moves to a new record and then writes the variables into the new record. In this way you are not bound to any sequentiality
 
...I am assuming we could fill out the new Full Name and double click on it to get the previous record filled to the new one...
You just need to turn your scenario around...after completely filling out a Record for the first person in the household, then Double-Click the name field, and copy that data, minus the name, into a New Record. Assuming the Control name actually is Full_Name, this will do the job:
Code:
Private Sub Full_Name_DblClick(Cancel As Integer)

 DoCmd.RunCommand acCmdSelectRecord
 DoCmd.RunCommand acCmdCopy
 DoCmd.RunCommand acCmdPasteAppend
 
 Me.Full_Name = Null

End Sub

Linq ;0)>
 
THanks I will give the vba a go and let yall know how it turns out! =)
 
Oh My Gosh the VBA worked like a treat! Thanks!

I saw suggestions from building special queries to copy paste a row, this will be the simple way for my users.

Private Sub Full_Name_DblClick(Cancel As Integer)
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
DoCmd.RunCommand acCmdPasteAppend

Me.Full_Name = Null
End Sub

I posted the code just in in case anyone else needs it. and the Me.Full_Name to make the full name empty for a new name was a great addition!

We take reservations on a datasheet view for customers and below in another datasheet we add the families reservation. You can bet that since the family all rides at the same time but with different rides, we can use this for our reservations datasheet subform as well.
Thanks!!
 

Users who are viewing this thread

Back
Top Bottom