Inserting Data

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

Hi

I've created a form based on a query. Basically my screen is to allow the
user to input timesheet hours. I have 7 fields listed Monday thru to
Sunday. The user enters the number next to the day.

I want to create a command button so that when clicked it will use a SQL
command to insert the data into a separate table. I get as far as INSERT
INTO TIMESHEETS(... but then I'm not sure how to reference the values in
the fields to insert into the table. For example if in my table I have a
column headed MondayHours and on my form I have a text box called Monday,
how do I insert the number entered in this field into my table.

Any ideas gratefully received!

Thanks
 
Hi,


DoCmd.RunSQL "INSERT INTO tableName( f1, f2, f3) VALUES( FORMS!formName!c1,
FORMS!formName!c2, FORMS!formName!c3)"


is a possible way, which work without the need to use delimiter (text or
date_time delimiter), as long as you use DoCmd.RunSQL rather than
CurrentDb.Execute.



Hoping it may help,
Vanderghast, Access MVP
 
Back
Top