duplicate record in from and subform (1 Viewer)

Orthodox Dave

Home Developer
Local time
Today, 04:34
Joined
Apr 13, 2017
Messages
218
Glad it worked. Don't forget to mark the thread as Solved (in Thread Tools top of page)
 

jdraw

Super Moderator
Staff member
Local time
Yesterday, 23:34
Joined
Jan 23, 2006
Messages
15,379
Inviter,

Do you have a specification or statement of requirements?

In database and application development, you seem to have a classic "scope creep" approach.

Here is wikipedia description:
Scope creep (also called requirement creep, function creep, or kitchen sink syndrome) in project management refers to changes, continuous or uncontrolled growth in a project's scope, at any point after the project begins. This can occur when the scope of a project is not properly defined, documented, or controlled.
 

theinviter

Registered User.
Local time
Yesterday, 20:34
Joined
Aug 14, 2014
Messages
240
Inviter,

Do you have a specification or statement of requirements?

In database and application development, you seem to have a classic "scope creep" approach.

Here is wikipedia description:
Scope creep (also called requirement creep, function creep, or kitchen sink syndrome) in project management refers to changes, continuous or uncontrolled growth in a project's scope, at any point after the project begins. This can occur when the scope of a project is not properly defined, documented, or controlled.


'***HERE IS THE NEW CODE
strSql = "INSERT INTO Table2 ( s1, s2 ) " & _
"SELECT Table2.s1, " & lngID & " AS Expr1 " & _
"FROM Table1 INNER JOIN Table2 ON Table1.ID = Table2.s2 " & _
"WHERE (((Table1.ID)=" & lngOldID & "));"

i mean any advise on how to modify this code if i want to additional field in table 2 (s3, s4)
 

theinviter

Registered User.
Local time
Yesterday, 20:34
Joined
Aug 14, 2014
Messages
240
'***HERE IS THE NEW CODE
strSql = "INSERT INTO Table2 ( s1, s2 ) " & _
"SELECT Table2.s1, " & lngID & " AS Expr1 " & _
"FROM Table1 INNER JOIN Table2 ON Table1.ID = Table2.s2 " & _
"WHERE (((Table1.ID)=" & lngOldID & "));"

i mean any advise on how to modify this code if i want to additional field in table 2 (s3, s4)


i done it

thanks alot
 

Orthodox Dave

Home Developer
Local time
Today, 04:34
Joined
Apr 13, 2017
Messages
218
You have the Insert SQL statement:

"INSERT INTO Table2 ( s1, s2 ) SELECT Table2.s1, " & lngID & " AS Expr1 " & _
"FROM Table1 INNER JOIN Table2 ON Table1.ID = Table2.s2 WHERE (((Table1.ID)=" &
lngOldID & "));"

For each field in the INSERT INTO statement, there are values in the SELECT statement. So if you add more fields in the INSERT INTO statement, you need to add more values in the SELECT statement. The SELECT statement shows you what values to put into the fields in the INSERT INTO statement, and in the same order. In the above example, the value of Table2.s1 is inserted into field s1, and the value lngOldID is inserted into field s2.

You can test any SQL statement by putting the SQL (without the quotes) into the Access Query builder SQL area, then clicking Design View to see exactly what it is doing in graphic form. That is the way I always build my SQL statements - it's so much easier to see what you are doing.
 

Users who are viewing this thread

Top Bottom