create a record in a table with values from a form

XaloRichie

Registered User.
Local time
Today, 03:24
Joined
Jul 2, 2003
Messages
70
I have a form with text boxes that are updated with their values from other forms or dlookups. I want to take that information on the form and create a record in a table with that data.
Whats the Best / easiest way to do this?
 
Hmmmn, The textboxes which contain the values have to be unbound for them to recieve the values from the called functions or public variables (I think).
And I want to create a new record in a table with the various values from those text boxes. If what you say will work can you give me a small example?
Thanks:
 
Create Command button on form and name it "cmdInsert"
In code window:
Private Sub cmdInsert_Click()

DoCmd.SetWarnings False
DoCmd.RunSql "Insert into YourTableName(YourFieldName) values(Forms!YourFormName.YourTextBoxName)
DoCmd.SetWarnings True

End Sub
 
While I'm pretty sure some Access veteran will yell at me for this, I was never trained in Access and thus came up with my own methods for things. For making new records based on text boxes, I created a set of "buffer" text boxes that were bound to the fields you were modifying. I then either hid them or made them really small. The actual data entry was done in the text boxes you already have set up. Then create a button, create a macro for it, in that macro go to a new record, use "SetValue" to set all of the hidden (though note that they must be visible) bounded textboxes to the values of your modifiable text boxes and voila.
 

Users who are viewing this thread

Back
Top Bottom