469,658 Members | 1,862 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,658 developers. It's quick & easy.

INSERT Value into table after update. single value INSERT

gcoaster
117 100+
Hello Gurus,
I am stuck! this will be easy I am sure for you.

I have a Text Box where I type In a name.
I am trying to get that value to insert into another table when I TAB to the next field.

Most of the INSERT code examples I find deal with multiple VALUES.
could you point me in the right direction?


thank you!
Nov 28 '07 #1
7 13996
In the After update event, I would use an Append query to Insert the the record.

Something like:

Expand|Select|Wrap|Line Numbers
  1. CurrentDB.Execute "Insert into tblYourTable (Field1) Values('" & Me.TextBoxControl & "')"
  2.  


Hello Gurus,
I am stuck! this will be easy I am sure for you.

I have a Text Box where I type In a name.
I am trying to get that value to insert into another table when I TAB to the next field.

Most of the INSERT code examples I find deal with multiple VALUES.
could you point me in the right direction?


thank you!
Nov 28 '07 #2
gcoaster
117 100+
oh man.. You guys ROCK! !
IT WORKS!! sorry, I spent 3 hours trying to figure it out and to see it work kinda was exciting..

Expand|Select|Wrap|Line Numbers
  1. Private Sub txtBoxName_AfterUpdate()
  2. CurrentDb.Execute "Insert into tblNames (firstName) Values('" & Me.txtBoxName& "')"
  3. End Sub
Nov 28 '07 #3
gcoaster
117 100+
ok.

INSERT inserts a new value and RECORD when txtBoxName is updated or if modified.

How doI write code to update if there is already a value?

thank you
Nov 28 '07 #4
How will you know wich record to update?

You will need to someway identify the record by something unique like the Primary key.

I normally do not do this. I would just insert an additional transactional record.

If we know what you are trying to do, we will be able to help you find the best solution.

What are you trying to accomplish?
Nov 28 '07 #5
gcoaster
117 100+
I have a field in a subform that i want to update with what is entered in the main form.

table 1 is bound to fmMAIN and Table2 is bound to fmMAINsub

when I enter domain text into domain field in Table1 I need code that udpates in the afterUpdate and inserts into the domainName column in Table2 or udpdates if text is changd. and maybe in another field in a table in the database

TABLE1
webID
clientFK
domain

TABLE2
webDetails
webFK
clientFK
domainName
Nov 28 '07 #6
MMcCarthy
14,534 Expert Mod 8TB
Sorry to butt in, but this sounds like you are duplicating information for domain in both tables. If not then I don't understand what you are doing.
Dec 11 '07 #7
gcoaster
117 100+
Hello mmccarthy!!
You can butt in anytime you like princess!

Mary, I have just learned vba in the last 2 months and had a time figuring it out.
I am still having a hard time wording things properly. like for instance, 2 months ago questions and searches about
"cascade combo boxes" where worded
"filtering results from dropdown"

here was the solution to my problem

This code is getting email address from combobox in column 3 and populating
field on form named clientEmail.

Expand|Select|Wrap|Line Numbers
  1. Private Sub cboFullName_AfterUpdate()
  2. Me.clientEmail = Me.cboFullName.Column(2)
  3. End Sub
  4.  
I have learned you can bring in more then 2 values using wizard for combobox on a main form and then use those values from it to populate textboxes on forms etc one of the many tricks i have learned on here.

thank you very much and may the Lord bless you this Christmas
gcoaster
Dec 13 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

16 posts views Thread by robert | last post: by
20 posts views Thread by Mark Harrison | last post: by
8 posts views Thread by nano2k | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.