Post unbound form data to table

eforce

Registered User.
Local time
Yesterday, 20:24
Joined
Mar 25, 2002
Messages
44
What is the syntax to use on an "cmdUpdate" button if I want the data that was entered on a form with unbound fields to post to a specific table.

I'm told that i should never use a table as the direct record source from a form but I am having problems doing this any other way.

Its a data entry form that users fill out from their front end located on their PC. I want them to open up their form, fill in the data, then a connection would be opened to the SQL server and all their data would be transfered over into the table.

Data is validated as the user enters the info into the form. If that record is already present (primary key is SSN) in the table the new data would simply update the record and not copy over it.

Thanks,

Eforce!
 
That is correct, you should not use a table as the recordsource for the form. That doesn't mean that you can't use bound forms. You can use a query as the form's recordsource. That way, you can use criteria to limit the number of rows in the form's recordset. That is the main objection to binding forms to tables. A form bound to a table causes Access to fetch ALL table rows, not just the one that is visible. This can be quite disruptive if the table is large or the LAN is slow.
 
Thanks Pat,
But how would I "add record", "edit record" ect.. if the form is bound to a query that fetches records from the table rather than the table that I want to add, delete, or edit to?.

Eforce
 
Dim SQLstr As String
SQLstr = "INSERT INTO orders ( id_order,money_def,note_def,orderfull)"
SQLstr = SQLstr & "VALUES ('" & Me.id_order & "','"
SQLstr = SQLstr & Me.money_def & "','"
SQLstr = SQLstr & Me.note & "','"
SQLstr = SQLstr & Me.orderfullID & "');"
CurrentDb.Execute SQLstr


'erase table order_details_temp
SQLstr = "DELETE * FROM order_details_temp"
CurrentDb.Execute SQLstr
 

Users who are viewing this thread

Back
Top Bottom