open form for new entry with certain field pre-populated

  • Thread starter FJC via AccessMonster.com
  • Start date
F

FJC via AccessMonster.com

Hi There,

I have two forms (based on two tables) company and meeting

I want to view the company information then click a button to open the
meeting form and record a new meeting.

I have created a command button to do this (using a wizard and the 'open the
form and find specific data to display' option) however, my meeting table is
empty.

So really what I want is the cmd button to:

Open the meetings form as a new record
populate the company field
and let me enter a meeting note.

But I don't know how to do that. Could someone help me with the code?

Thanks,
FJC
 
A

Access101

If I understand correctly, you could do the following:

CompanyID from Company table as Foreign Key in Meeting Table

Then create Form based on Company table, and a SUB form based on Meeting
table. The Parent/Child field would be the CompanyID, and you could view the
meetings for each company as you schedule a new one.

Let me know if that helps.
 
F

FJC via AccessMonster.com

Thank you. That does work.

I am still curious about the code for the 2-form way.
If I understand correctly, you could do the following:

CompanyID from Company table as Foreign Key in Meeting Table

Then create Form based on Company table, and a SUB form based on Meeting
table. The Parent/Child field would be the CompanyID, and you could view the
meetings for each company as you schedule a new one.

Let me know if that helps.
Hi There,
[quoted text clipped - 17 lines]
Thanks,
FJC
 
D

Dale Fye

I think I would just pass the meeting form a value in the OpenArg argument
of the OpenForm method.

Then in the meetings forms Open event, I would check to see if you are on a
new record, and if there is an OpenArg value. If so, I would populate the
company field with that value.

HTH
Dale
 
J

Jason

after docmd.open add
if isnull(forms(formname)!fieldname) then forms(formname)!fieldname = value
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top