Update field parameter by control button

MrGrumpy

I'm *NOT* Grumpy OK!!
Local time
Tomorrow, 07:11
Joined
Dec 16, 2008
Messages
11
Hi, I have been tasked to create a visitors database for our facility. I have a main form which shows contractors / visitors etc who are currently clocked in (in a subform), and those which are clocked out (another subform). Originally, I was going to do this by a dbl click event procedure, however, the big cheeses over here want to do this via a Visitor Profile form, and they want the "Clock In" and "Clock out" to be by a button.

So... double click a name from one of the subforms to bring up the visitors profile in one of 2 forms (both forms are identical, except one states "Visitor clocked in", and the other states "Visitor clocked out"). I need to have a button on each form, which changes the "Status" from "Clocked Out" to "Clocked In" (or from "Clocked in" to "Clocked out").

I can do this at home on Office 2007 by running a macro from a command button. We run Access 2003 here at work, and I haven't managed to get my head around the macros on this version yet.

Just to clarify, I am after advice on the "buttons" which changes the visitor status.

Thanks in advance.
 
Hi again,

I have attached a macro to a command button on my Visitor Profile form. The macro *should* do the following (at least it would if I knew what I was doing!) :

SetValue - [Visitor]![Status]="Clocked Out"
Close - Clocked_In form - which is the visitor profile form
Close - Home form - which is the main form.
Open - Home form

What I want to do is change the status to "Clocked Out", close the Clocked_In form, and refresh the data in the Home form (which should be already open).

What is happening is the Clocked_In form closes. The Home form closes, and opens. But the status does not change to "Clocked Out".

This is the code attached to the command button.

Private Sub Clock_Out_cmdbtn_Click()
On Error GoTo Err_Clock_Out_cmdbtn_Click
Dim stDocName As String
stDocName = "Macro_Clock_Out"
DoCmd.RunMacro stDocName
Exit_Clock_Out_cmdbtn_Click:
Exit Sub
Err_Clock_Out_cmdbtn_Click:
MsgBox Err.Description
Resume Exit_Clock_Out_cmdbtn_Click

End Sub

I don't think the problem is in the coding, but in the macro. In particular, the SetValue command.

Can someone please help me? I have searched the forums, and can't find an answer to this.

Thanks.
 

Users who are viewing this thread

Back
Top Bottom