By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,967 Members | 1,710 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,967 IT Pros & Developers. It's quick & easy.

Attendance register for a farm

P: 5
Hi I am a self thought in access and been creating a couple of data bases for my farm.I am now building a attendance register and is keeping it as simple as possible.Table is as follow:
id(auto) : Date (=now()) : Employee 1 : Employee 2 : Employee 3 ................

What I need is to insert the value 1 into the field when a command button is clicked.The plan is to make a command button with the employee's picture on it that needs to be clicked for attendance.I am working with un schooled staff that doesn't know any thing about pc's.
The expression that I have tried is : on click : = [employee 1] = 1 but with no luck!
Mar 17 '07 #1
Share this Question
Share on Google+
4 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
Hi I am a self thought in access and been creating a couple of data bases for my farm.I am now building a attendance register and is keeping it as simple as possible.Table is as follow:
id(auto) : Date (=now()) : Employee 1 : Employee 2 : Employee 3 ................

What I need is to insert the value 1 into the field when a command button is clicked.The plan is to make a command button with the employee's picture on it that needs to be clicked for attendance.I am working with un schooled staff that doesn't know any thing about pc's.
The expression that I have tried is : on click : = [employee 1] = 1 but with no luck!
You need two tables. One with a list of Employees and the other for attendance as follows

tblEmployee
EmpNum (Primary Key - Autonumber)
EmpName

tblAttendance
AttendID (Primary Key - Autonumber)
DateWorked
EmpNum (Foreign Key Reference to tblEmployee)

Now in the button On Click Event
Expand|Select|Wrap|Line Numbers
  1. Private Sub BtnName_Click()
  2. Dim strSQL As String
  3.  
  4.    strSQL = "INSERT INTO tblAttendance ([DateWorked], [EmpNum]) " & _
  5.       "VALUES (" & Now() & ", " & 1 & ");"
  6.    DoCmd.RunSQL strSQL
  7.  
  8. End Sub
  9.  
Mary
Mar 17 '07 #2

P: 5
Thank you for the reply
This sounds stupid but in witch form must the button be?
1) The tblAttendance form or a new form?
I tried the a new for with just the button on it but if I run the code I get a Run-time error '3075'
Syntax error (missing operator)
What I rather would like to do is having a table with the names of the employees in each column and the date as auto.
i.e..
tbl Attendance:

ID : (auto nr)
Date : (=now())
Peter : (data type , number)
John ;(data type , number)
Jack(data type , number) .......

The fields it self would not be visible on the form but only the Pictures of the employee's.
When button click the value 1 would be inserted in to the corresponding field.
Only reason I use the value 1 is that at the end of the month I will add each column together to get the days worked for a month.
To be honest I don't know much about coding but are learning at a huge pace. :)

Ps.The form will be auto loaded when access starts up and after the form is updated it will close and open the control form.
Mar 18 '07 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
Try this ...
Expand|Select|Wrap|Line Numbers
  1. Private Sub BtnName_Click()
  2. Dim strSQL As String
  3.  
  4.    strSQL = "INSERT INTO tblAttendance ([John]) " & _
  5.       "VALUES ("& 1 & ");"
  6.    DoCmd.RunSQL strSQL
  7.  
  8. End Sub
Just change the column name for each button.
Mar 20 '07 #4

P: 19
Hi I am a self thought in access and been creating a couple of data bases for my farm.I am now building a attendance register and is keeping it as simple as possible.Table is as follow:
id(auto) : Date (=now()) : Employee 1 : Employee 2 : Employee 3 ................

What I need is to insert the value 1 into the field when a command button is clicked.The plan is to make a command button with the employee's picture on it that needs to be clicked for attendance.I am working with un schooled staff that doesn't know any thing about pc's.
The expression that I have tried is : on click : = [employee 1] = 1 but with no luck!
hi..am also doing same,if u have a correct code,can u please share me this..
please reply..thanks in advance..
Oct 15 '07 #5

Post your reply

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