Avatar of rltomalin
rltomalin
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Open a form for a new record

I have a database that has tables for Clients and Jobs (tblClients and tblJobs)

Currently working is a form to add a new job.
This form has a query that joins tblClients and tblJobs
It is called from a button on a menu form using…
stDocName = "frmNewJob"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    DoCmd.GoToRecord , , acNewRec

On this form is a field cboClient.  The user selects the Client in this combo box and it populates the client details on the form.  The user then enters the new job information and saves to create the new job.
This is all working fine and has been for ages.

Now I want to do almost the same thing, but calling a copy of the above form – frmNewJobFromEditClient from the client details form.
So when the new form is opened I want it to open as a new record but with the Client details already populated (as if the user had selected the correct client).

I assumed that I would be able to put something like…
Me.cboClient = [frmEditClient].[Client ID]
in the Open event of the frmNewJobFromEditClient form.
I have tried all sorts of options of syntax without success.

Hope someone can help me out.

Regards
Richard
DatabasesMicrosoft Access

Avatar of undefined
Last Comment
Dale Fye

8/22/2022 - Mon
Juan Ocasio

I was just checking out some of the templates in Access and came across the Assets template (access 2016).  Take a look at it.  On the welcome page, it has a link to a video that shows how to use the template and it does something very similar.  It uses macros, but you can convert the macros to vba code.
rltomalin

ASKER
Sorry, don't have Access 2016.  Currently using Access 2010.
ASKER CERTIFIED SOLUTION
Dale Fye

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
rltomalin

ASKER
Excellent response - thank you.  This was absolutely appropriate to my questions and easy to follow.
Had it working in 10 minutes.  I would never have figured this out myself.  I have done Access programming in the past but really only rarely - so need a nudge from time to time.
Regards
Richard
Your help has saved me hundreds of hours of internet surfing.
fblack61
Dale Fye

glad to help.  Don't forget to close out the question.