developingprogrammer
asked on
insert sql using both VALUES and SUB-QUERY
hi guys,
i can write an insert query and use VALUES to insert the data i want. i can also use a subquery to insert the data. can i use a mixture of 2 or must i write 2 queries?
e.g. join the 2 lines of code into 1
i can write an insert query and use VALUES to insert the data i want. i can also use a subquery to insert the data. can i use a mixture of 2 or must i write 2 queries?
e.g. join the 2 lines of code into 1
Sub InsertQuery_UsingValuesOnly()
Call CurrentDb.Execute("INSERT INTO DestinationTable (TableField1, TableField2) VALUES (""something1"", ""something2"");")
End Sub
Sub InsertQuery_UsingSQLOnly()
Call CurrentDb.Execute("INSERT INTO DestinationTable (TableField1, TableField2) SELECT ExistingInformation.Existing1, ExistingInformation.Existing2 FROM ExistingInformation;")
End Sub
Do you like to insert some default values if you have no existing data in ExistingInformation?
ASKER
Yes I would = )
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
yup guys i agree, it may take a bit too much effort - i should just keep it simple = ) thanks guys!! = ))