troubleshooting Question

Insert into help with autonumber.

Avatar of CaptainGiblets
CaptainGibletsFlag for United Kingdom of Great Britain and Northern Ireland asked on
Microsoft AccessMicrosoft SQL Server
6 Comments1 Solution1457 ViewsLast Modified:
i have the attatched code.

When i run the code it creates a new record in tblcustomerdetails, there is also a column in tblcustomerdetails called  AUTO   that is an auto number.  so i dont have a record of it anywhere as it is randomly generated.

i need to refer to this new AUTO created in tblcustomerdetails  in the code below it, so that i can paste that new AUTO into the AUTO field on the second table and still pull the rest of the information off as currently scripted.
CurrentProject.Connection.Execute _
    "INSERT INTO tblcustomerdetails ([Date Recorded], Name, [trading as name], Legalconstitution, salesperson, [type of application], [ai/kyc], [internal status], [Date sent to SMS], [Date Approved / Declined], [Date Dispatched], [Date Installed], [Date Active]) SELECT [Date Recorded], Name, [trading as name], Legalconstitution, salesperson, [type of application], [ai/kyc], [internal status], [Date sent to SMS], [Date Approved / Declined], [Date Dispatched], [Date Installed], [Date Active] FROM tblcustomerdetails WHERE tblcustomerdetails.auto = " & Me!subbasicc.Form!txtauto & ""
CurrentProject.Connection.Execute _
    "INSERT INTO tblcomments ([Auto], [handepay comments], [Streamline Comments], [Post Log], [handepay comments2], [Post Log Comments]) SELECT * FROM tblcustomerdetails WHERE tblcomments.auto = " & Me!subbasicc.Form!txtauto & ""
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros