How to store date from form to table field when clicking Save button

venu_resoju

Registered User.
Local time
Today, 07:57
Joined
Dec 29, 2010
Messages
130
Hai I am new to Ms Access and have created one simple attendance DB which is here with attached.
I want to store "Current Date" from "AttendanceDate in Attendance Form" to "AttendanceDate field in Attendance Table" when I click Save button.

any one please help me...Thanks in advance....
 

Attachments

Hai I am new to Ms Access and have created one simple attendance DB which is here with attached.
I want to store "Current Date" from "AttendanceDate in Attendance Form" to "AttendanceDate field in Attendance Table" when I click Save button.

any one please help me...Thanks in advance....

Hi Just bind the txtbox to the correct table field..
 

Attachments

Thank you Marinus...
please tell me the code..I want to get the EmpName when selecting EmpID in combo box in Attendance Form....
 
Thank you Marinus...
please tell me the code..I want to get the EmpName when selecting EmpID in combo box in Attendance Form....

There is no code m8, open Attendance form in design view, click on the field EmpName, right click for properties and in the second option Control Source choose EmpName, this binds the formfield EmpName to the tablefield EmpName. That's all there is to it..

Cheers..
 
Hi,

I looked at your Db and your code. There are some basic mistakes. On the onclick event of the cmdSave button, you must first declare the variable AttendanceDate as date, then assign value of the current date to it. eg
dim AttendanceDate as date
.
.
AttendanceDate = date

Likewise your database variable db was not assigned. As i believe you want to assign it to your db then set it as the currentdb like

set db = currentdb

Also use the with statement with rs thus
with rs
.addnew
!AttendanceDate = attendancedate
.update
.close
end with

Next I think you need to add record to the primary key for the update to take effect.

In the EmpID click you need to set rs properly like set rs = currentdb.openrecordset(....)
also remove the apostrophe from the select statement.
I hope this will work.
 
Thank you AliyuKatsina ...for your quick reply ...I am tired by trying the alterations that you have told..I am unable to complete..please help me ...

Thanks in advance....
 

Users who are viewing this thread

Back
Top Bottom