Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Insert and select SQL statement

Author  Topic 

Storm
Starting Member

10 Posts

Posted - 2009-08-24 : 11:39:24

Ok I have a access form that users will be entering data into. I want that data to go
into a access table I have created for later reporting use. What is the sql statement that
will transfer the data from the data entry form to the access table? Also the access for uses
a total of 3 tables. The 1st table 'Log' will just be used for storing the New user data. The
2nd and 3rd table 'Branch' & 'Status' needs to have random data pulled from it.

Here is what I have been working on so far.

INSERT INTO log ( [Last], [First], Gender, WorkLocation, Branch, Status, TimeIn )
SELECT new_user.current_last_name, new_user.current_first_name, new_user.sex_code,
new_user.work_address_secondary, Branch, Status,
Date$() & ", " & Left$(Time$(),5) AS TimeIn
FROM [Forms]![New User]![command43]

what else do I need to add? Also just remember on the answer I'm not a sql or access expert so
keep the answers really simple.

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2009-08-25 : 05:05:23
This is more a front end question than a SQL question (although it seems you are using Access, so its not even a SQL question).

Anyhow, you want to either bind your form fields to a table or you want to get the current value when you save the data and store than in variables, then you want to do a simple:


Insert into <tablename> (<fieldlist>)
values (<values>)

Where values will be something like:

values (@currlastname,@currfirstname,etc...)
Go to Top of Page
   

- Advertisement -