Saving values on the on click event (1 Viewer)

anthonyphillips

Registered User.
Local time
Today, 06:27
Joined
Nov 7, 2007
Messages
50
Hi guys

i am looking for a piece of code if anybody can help.

I have a text box that is hidden due to it mirroring another box that is running an equation. I assumed that a simple Me! function would work but alas . . no.

So what i need is code to allow me to save the value of my text box into my table from the on click event of the save record button!

Can anybody help please ?

Thanks

Anthony
 

padlocked17

Registered User.
Local time
Today, 00:27
Joined
Aug 29, 2007
Messages
276
You'll need to either call an update query and silence the warnings or you'll need to write the SQL in VBA.

Code:
DoCmd.SetWarnings False
                DoCmd.OpenQuery "qryAddStudEnroll", acViewNormal, acEdit
                DoCmd.SetWarnings True

I don't have a sample of the SQL VBA handy as I've converted over to doing everything with queries. They are much simpler to edit and change later.

Basically you create a query that will grad the Primary Key info and simply insert the one field you have into one field in the table if you desire.

If you build the form to have a recordsource and the primary key, once you click the save button, you can then run the update query that will pull the primary key from the current record on the form and use the data that is still in that control box to place in the table. That's as long as you used the DoCmd Save record function and not the NewRecord function to create a new record thus saving the previous.

Help any?
 

Users who are viewing this thread

Top Bottom