Dynamic Default Field Value

G

Guest

I have a form that is used for entering new data. All tables are linked by
empid #. I want the empid value to defaut to the current record in the
employee info table when I go to enter new data. I know I can do this just
by adding [Forms]![Employee infor form].[empid] in the default value of the
form field, but since I may be accessing this form from 2 other forms I was
wonderering if there is some way to dynamically select the form that I came
from. Keep in mind that it was not the last form I was on, but rather 2
forms prior.

I would be coming from Employee info by Loc form or from Employee info form.
 
G

Guest

Bob,

Is there any reason you couldn't put the other forms as subforms on the main
form, linked by the EmpID, perhaps each on its own tabbed page? Then you
don't need to enter the EmpID at all.

Sprinks
 
G

Guest

I like to use seperate forms to avoid users accidently being in an updateable
area. They have to select the update option so they know they are able to
edit. Plus the forms are pretty busy right now.

I was just wondering if this was possible.

Thanks for the reply.

Sprinks said:
Bob,

Is there any reason you couldn't put the other forms as subforms on the main
form, linked by the EmpID, perhaps each on its own tabbed page? Then you
don't need to enter the EmpID at all.

Sprinks

Bob said:
I have a form that is used for entering new data. All tables are linked by
empid #. I want the empid value to defaut to the current record in the
employee info table when I go to enter new data. I know I can do this just
by adding [Forms]![Employee infor form].[empid] in the default value of the
form field, but since I may be accessing this form from 2 other forms I was
wonderering if there is some way to dynamically select the form that I came
from. Keep in mind that it was not the last form I was on, but rather 2
forms prior.

I would be coming from Employee info by Loc form or from Employee info form.
 
G

Guest

Bob,

You can pass the record primary key to the new form using the OpenArgs
parameter. See VBA Help on the OpenForm method and the OpenArgs property.

Hope that helps.

Sprinks

Bob said:
I like to use seperate forms to avoid users accidently being in an updateable
area. They have to select the update option so they know they are able to
edit. Plus the forms are pretty busy right now.

I was just wondering if this was possible.

Thanks for the reply.

Sprinks said:
Bob,

Is there any reason you couldn't put the other forms as subforms on the main
form, linked by the EmpID, perhaps each on its own tabbed page? Then you
don't need to enter the EmpID at all.

Sprinks

Bob said:
I have a form that is used for entering new data. All tables are linked by
empid #. I want the empid value to defaut to the current record in the
employee info table when I go to enter new data. I know I can do this just
by adding [Forms]![Employee infor form].[empid] in the default value of the
form field, but since I may be accessing this form from 2 other forms I was
wonderering if there is some way to dynamically select the form that I came
from. Keep in mind that it was not the last form I was on, but rather 2
forms prior.

I would be coming from Employee info by Loc form or from Employee info form.
 

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