469,125 Members | 1,655 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,125 developers. It's quick & easy.

Close Form and update record in Table on field change

Please excuse any idiotic questions as Access/VBA is a new area to me.
I have inherited an Access Database/Application that is used to sign in and out visitors and Staff to our community Centre.
The system works fine and with the addition of extra screens(forms) we have managed to get it to work using touchscreen monitor and an OSK.
I was looking at using a Barcode Font (Free 3 of 9 Extended)to simplify signing in and out for Staff, and also so we are not showing list of signed in people on screen.
So how it works.
A visitor or staff member is presented with a screen offering choice of Visitor or Staff Member, whichever choice is made takes it to another screen (Form) that asks to sign in or Sign out.
In the Sign Out section a Staff Member Scans their ID badge (with Barcode and Numeric Staff ID) the form has an Unbound Text Box which has Focus when the Form is opened, after scanning ID Badge the next field (FullName) is Populated with The Staff ID No from Badge Barcode using a Search Record Macro with Control source [BadgeID], this then brings up the previous record from when they Signed in.
So Far so good. But this is where I am lost, I have a close Buttton (toggle Button) on the Form which closes the form but the record in the Table does not alter. The form is bound to table VisitorSigninOut. I have a Field in the Table called SignedOut and a Field called TimeOut, when the Form is opened in Edit mode these are the two fields on the form that are not on the Sign In form so I thought they would be added to the earlier record, but they don't. However if I assign the Control Source of the Toggle button as SignedOut the records are updated and we can see Visitor or staff in and out times. I guess this is incorrect way of doing this but it works. I could leave like this but what I would like to do is to have the Staff member go to the Sign Out form , pass their badge under the scanner and when their record appears for the form to update the record and close the form automatically. At the moment I am using Macros and wizards as I am a total non starter with VBA.
Any pointers or help is appreciated.
Apr 4 '12 #1
2 4849
Excuse my Error in the Paragraph under 'How it Works'
The correct method is A staff Member gets to the 'sign out form' then passes their ID Badge under Barcode Scanner, Field 1 (unbound)(attached is a Macro in 'before Update property' of field to Search for Record based on Badge ID No which is showing after scan) displays their Staff ID number and the Next Field FullName (bound to FullName control Source)and (Macro to requery) shows Staff Member name from Sign In record, not Badge ID as I posted.
Apr 4 '12 #2
759 512MB
Too long explanation for my English.
Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  4. Private Sub Button_Click()
  5. 'This will save the record if necessary (if the record has been modifyed
  6.     If Me.Dirty Then Me.Dirty = False
  8. 'This force to save the record
  9.     DoCmd.RunCommand acCmdSaveRecord
  11. 'This will close the form
  12.     DoCmd.Close acForm, "FormName"
  13. ''Or you can use
  14.     'DoCmd.Close acForm, Me.Name
  15. End Sub
Apr 5 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Tinius | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.