I need to fill tblA from within VBA code.
Two of the fields in tblB will provide data for two of the fields in tblA.
I think that is pretty straight forward as in:
strInsertSQL = "INSERT INTO tblA(fld1, fld2) " _
& "Select fldA, fldB " _
& "From tblB ;"
DoCmd.RunSQL (strInsertSQL)
Can I, in the same statement, INSERT a repeating Value for fld3.
The Value would be a string equating to the FieldName of fldC in tblB.
I can get the fieldName into a variable, strFldName but do not know
the syntax to include it in the INSERT statement.
Access help file does not help.
I think I could do it with first an INSERT and then an UPDATE but would
prefer
something where the process either succeeds or fails as one.
Thanks in advance for any help. 2 5272
Kc-Mass wrote:
I need to fill tblA from within VBA code.
Two of the fields in tblB will provide data for two of the fields in tblA.
I think that is pretty straight forward as in:
strInsertSQL = "INSERT INTO tblA(fld1, fld2) " _
& "Select fldA, fldB " _
& "From tblB ;"
DoCmd.RunSQL (strInsertSQL)
Can I, in the same statement, INSERT a repeating Value for fld3.
The Value would be a string equating to the FieldName of fldC in tblB.
I can get the fieldName into a variable, strFldName but do not know
the syntax to include it in the INSERT statement.
Access help file does not help.
I think I could do it with first an INSERT and then an UPDATE but would
prefer
something where the process either succeeds or fails as one.
Try something like this:
strText = "foo"
strInsertSQL = _
"INSERT INTO tblA(fld1, fld2, fld3) " _
& "Select fldA, fldB, '" & strText & "' AS Expr1 " _
& "From tblB ;"
Terrific. Thank you very much!
"Gord" <gd*@kingston.netwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
>
Kc-Mass wrote:
>I need to fill tblA from within VBA code.
Two of the fields in tblB will provide data for two of the fields in tblA.
I think that is pretty straight forward as in:
strInsertSQL = "INSERT INTO tblA(fld1, fld2) " _ & "Select fldA, fldB " _ & "From tblB ;" DoCmd.RunSQL (strInsertSQL)
Can I, in the same statement, INSERT a repeating Value for fld3. The Value would be a string equating to the FieldName of fldC in tblB. I can get the fieldName into a variable, strFldName but do not know the syntax to include it in the INSERT statement.
Access help file does not help.
I think I could do it with first an INSERT and then an UPDATE but would prefer something where the process either succeeds or fails as one.
Try something like this:
strText = "foo"
strInsertSQL = _
"INSERT INTO tblA(fld1, fld2, fld3) " _
& "Select fldA, fldB, '" & strText & "' AS Expr1 " _
& "From tblB ;" This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: John Keeling |
last post by:
Dear all,
I tried the test program below. My interest is to examine timing
differences between insert vs. append & reverse for a list. My results
on my XP Python 2.3.4 are as follows:...
|
by: me |
last post by:
I'm also having problems getting the bulk insert to work. I don't know
anything about it except what I've gleened from BOL but I'm not seeming to
get anywhere...Hopefully there is some little (or...
|
by: Mark P |
last post by:
Some time ago I posted here about inserting into a set with a hint:
...
|
by: akej via SQLMonster.com |
last post by:
Hi, i have table with 15 columns
CREATE TABLE . (
PRIMARY KEY ,
NULL ,
NULL ,
NULL ,
NULL ,
(50) NULL ,
NULL
|
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...
|
by: Carl |
last post by:
Hi,
I hope someone can share some of their professional advice and help me out
with my embarissing problem concerning an Access INSERT query. I have never
attempted to create a table with...
|
by: deko |
last post by:
I'm trying to log error messages and sometimes (no telling when or where)
the message contains a string with double quotes. Is there a way get the
query to insert the string with the double...
|
by: jcsnippets.atspace.com |
last post by:
Hi everyone,
Recently I have posted a question regarding special characters in text
files. I was trying to read the text file to process the text later on, but
I was using the wrong encoding....
|
by: Ted |
last post by:
OK, I tried this:
USE Alert_db;
BULK INSERT funds FROM 'C:\\data\\myData.dat'
WITH (FIELDTERMINATOR='\t',
KEEPNULLS,
ROWTERMINATOR='\r\n');
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |