sistemalan
Registered User.
- Local time
- Today, 15:12
- Joined
- Jun 19, 2009
- Messages
- 77
Hi all and thanks for taking the time to read,
I have built a database for monitoring attendance of children at one of our charity's music projects. I have a form which lists all children on the register and allows me to tick a box for each child in attendance on a certain day. The form is bound to a temporary attendance table. I can type the correct date in an unbound field in the form footer and click a button which runs an update query, transferring the information from the temporary form into a table called "AttendanceTable New".
I'd like to avoid the possibility of forgetting to update the date and put in two lots of data for the same date. Can someone help me with the VBA code to do the following:
When button is pressed check to see if any records in the date collum of the Master Attendance Table match the date in the unbound text box on the form.
If they do, show a message and do not run the update query
If not, run the update query.
The VBA for the button currently looks like this.
Many thanks for any help, I think it might take a while for me to figure this out on my own, but I suspect it's pretty easy for one with knowledge.
Alan
I have built a database for monitoring attendance of children at one of our charity's music projects. I have a form which lists all children on the register and allows me to tick a box for each child in attendance on a certain day. The form is bound to a temporary attendance table. I can type the correct date in an unbound field in the form footer and click a button which runs an update query, transferring the information from the temporary form into a table called "AttendanceTable New".
I'd like to avoid the possibility of forgetting to update the date and put in two lots of data for the same date. Can someone help me with the VBA code to do the following:
When button is pressed check to see if any records in the date collum of the Master Attendance Table match the date in the unbound text box on the form.
If they do, show a message and do not run the update query
If not, run the update query.
The VBA for the button currently looks like this.
Code:
Private Sub Command10_Click()
On Error GoTo Err_Command10_Click
Dim stDocName As String
Me.Refresh
stDocName = "Attendance Append Query"
DoCmd.OpenQuery stDocName, acNormal, acEdit
stDocName = "Attendance Reset Query"
DoCmd.OpenQuery stDocName, acNormal, acEdit
MsgBox "Attendance Updated. Hoozah!"
Me.Refresh
Exit_Command10_Click:
Exit Sub
Err_Command10_Click:
MsgBox Err.Description
Resume Exit_Command10_Click
End Sub
Many thanks for any help, I think it might take a while for me to figure this out on my own, but I suspect it's pretty easy for one with knowledge.
Alan