473,386 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 14389
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

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

Similar topics

6
by: a-ok | last post by:
Hi, My client has a product database od around 20000 items. And it is updated every few days when he gets a catalog from the supplier. It's supposed to work like this: if there already is a...
4
by: DTB | last post by:
I am having trouble creating an INSTEAD OF trigger in SQL Server to replicate a BEFORE UPDATE trigger from ORACLE. Here is a sample of the ORACLE BEFORE UPDATE trigger: CREATE TRIGGER myTRIGGER ON...
11
by: Randell D. | last post by:
Folks, I have a table of addresses and a seperate table with contact names - All addresses tie to one or more names - I would like to keep track of the number of names 'belonging' to an address...
1
by: shottarum | last post by:
I currently have 2 tables as follows: CREATE TABLE . ( mhan8 int, mhac02 varchar(5), mhmot varchar(5), mhupmj int )
14
by: serge | last post by:
I have a scenario where two tables are in a One-to-Many relationship and I need to move the data from the Many table to the One table so that it becomes a One-to-One relationship. I need to...
16
by: robert | last post by:
been ruminating on the question (mostly in a 390/v7 context) of whether, and if so when, a row update becomes an insert/delete. i assume that there is a threshold on the number of columns of the...
5
by: Klemens | last post by:
I get SQL30090 reason 18 by trying to do an insert in a federated table and an update in a local table in one transaction Do I have to change some settings to get done or ist this not possible by...
20
by: Mark Harrison | last post by:
So I have some data that I want to put into a table. If the row already exists (as defined by the primary key), I would like to update the row. Otherwise, I would like to insert the row. I've...
8
by: nano2k | last post by:
Hi Shortly, I keep invoices in a table. Occasionally, someone will fire the execution of a stored procedure (SP) that performs several UPDATEs against (potentially) all invoices OLDER than a...
8
by: SaltyBoat | last post by:
Needing to import and parse data from a large PDF file into an Access 2002 table: I start by converted the PDF file to a html file. Then I read this html text file, line by line, into a table...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.