Hi,
you could just make the form bound and then when the record loses focus it
will save the data to the appropriate fields. If this is unbound you could
use code like this:
Dim rs As New ADODB.Recordset
Dim varItem As Variant
rs.Open "tblYourTable", CurrentProject.Connection, adOpenDynamic,
adLockOptimistic
rs.AddNew
rs!Field01 = Me.YourControl01
rs!Field02 = Me.YourControl02
rs.Update
rs.Close
Set rs = Nothing
HTH
Good luck

Signature
Oliver
Admin Specialist & Computer Science Major @ UMD - Go Terps - :)
> Just wondering how I would write data to a table on a button click
> after i have entered the data into a form. All help appreciated.
If you don't want to deal with VBA, you could use a Macro to run a Query.
Create an Append Query based on your table. Choose your table as the Append
Table or target table. In the Criteria portion of the Query, you will put
the controlnames as the condition. Exp:
[Forms]![YourFormsName]![YourTxtBox]
Then on the click event, choose Macro. On the Action pull down, select
OpenQuery. In the Action Arguments Box at the bottom, select your Query
Name, and Data mode. Save your Macro and exit.
When you click the button, it should run the Append Query, and update your
table. Macros are easy to use for certain situations. Once you become more
familiar with VBA, it allow you greater flexibility to modify actions on the
fly. Good Luck!
> Just wondering how I would write data to a table on a button click
> after i have entered the data into a form. All help appreciated.
J - 06 Jan 2006 12:43 GMT
I'm still having some problems. I set up the macro to run the query but
apparently it's saying "You are about to append 0 Rows" Some data that
I have is:
Field: Quantity
Table: Inventory Table
Sort:
Append To: Quantity
Criteria: [Forms]![Inventory Entry Screen]![Quantity]
Or
Kou Vang - 06 Jan 2006 15:22 GMT
Okay, I know what I told you wrong now. Instead of filling out the criteria
portion of the query, we'll just put it right into the field. In the field
write:
Field: Quantity: [forms]![Inventory Entry Screen]![Quantity]
Do this for all the controls you want to populate in your table.
Leave the Table: blank and the Criteria: blank and it should work now. Let
me know if it doesn't. Good luck.
> I'm still having some problems. I set up the macro to run the query but
> apparently it's saying "You are about to append 0 Rows" Some data that
[quoted text clipped - 6 lines]
> Criteria: [Forms]![Inventory Entry Screen]![Quantity]
> Or