Insert "Same" attendance to another record (1 Viewer)

lcook1974

Registered User.
Local time
Today, 16:00
Joined
Dec 21, 2007
Messages
330
Good morning!!!

I have a form where we do "After Actions" on different case through out the month. I have an attendance form where we take everyone's name who is there...

Once one record is done we move to the next record but I (nor does any one else) want to re-type all the names again. So I have a check box that says.."Same attendance as last record?"

When I check this box I want it to insert into the table Attendance the same list of names that was on the previous record.

This is what I have...
Code:
 DoCmd.RunSQL "INSERT INTO MedAAR_Attendance ( Name, Role, MedAARID )" & _
"SELECT MedAAR_Attendance.Name, MedAAR_Attendance.Role, MedAAR_Attendance.MedAARID" & _
"FROM MedAAR_Attendance " & _
"WHERE Me.MAAR_ID - 1 = (Select Top 1 MedAARID From MedAARAttendance)"

There are fields for date (which are set to Now() ) Should I use that in the where statement instead of the MedAARID?

Thanks!
Larry
 

James Dudden

Access VBA Developer
Local time
Today, 21:00
Joined
Aug 11, 2008
Messages
369
Are you writing in to the form and then copying the new data across. If so I did something similar recently but here's how i did it.

In vba create Public variables for each field you want to copy.
On the AfterInsert of the form copy the data from each field in to the variables.
Now when you click the "Copy" buttons run code to paste the variables in to the correct fields.
 

lcook1974

Registered User.
Local time
Today, 16:00
Joined
Dec 21, 2007
Messages
330
Thank you James!!! I'll look into doing that...it sounds much simplier but I am "not to good" at writing VBA.

I'll give it a shot though.

Larry
 

Users who are viewing this thread

Top Bottom