Same record for multiple forms

G

Guest

I am using Access 2003. I am familiar with the very basics of VBA but I
think my problem can be solved with some help regarding vba and syntax.

We refurbish & recover rollers from paper producing machines at our
facility. I am working on a database that will centralize al the data that
is generated when the roll comes in for service. Currently each dept keeps a
record of just what they do. Below is sample production route that I have
simplified:

1. The Roll is recieved and given a unique sales order number.
2. Roll goes through an inspection process.
3. Roll receives a new cover.
4. The new cover is ground to customer specs.
5. Roll is balanced.
6. Roll is shipped to customer.

I have created a main form (roll_data) that is the main screen for
monitoring a roll through the plant. The customer service rep creates a new
record when received in the roll_data form with basic info for the roll along
with the customer info and assigns a sales order number. The roll_data pulls
certain info from the forms listed below for ease of viewing instead of
pulling up every form.

Additional forms include the inspection_form, cover_form, grinding_form,
balance_form and shipping_form. Each form has it's own table using the sales
order number as the primary key. Each department populates the appropriate
field with data for the roll. Example: The Grinding dept will populate the
grinding_form and so on. I had to split each process into it's own
form/table due to field limitations in access.

The problem: If I have a roll for sales order 402818 displayed on the main
form (roll_data) and click one of the links I have to another form
(inspection, cover, grinding, balance, shipping), I want it to pull up the
appropriate form for sales order 402818. Instead, it pulls up the first
record in that table.

I have researched it here and it sounds like I will need to apply some sort
of filter or where staement to the button to carry the sales order (primary
key for each table) forward. I have even played with the OpenArgs statement
with no success.

Please understand that I am an IT person by trade but have not had alot of
experience with actual coding. It has been difficult for me to get out of my
Excel mindset.

Thanks for any and all help!
 
D

Damon Heron

Openargs should work. What was the problem you were having?
Here is how to do it:

The command button that calls up the form you want:

-enter in the click event-
dim selected as variant 'using variant here because I don't know your
datatype - it could be long?
selected= me.[yoursalesorderfield]
docmd.openform "your formname",acnormal,,,,acdialog, selected

then on the load event of the form you are opening,
me.[yoursalesorderfieldon the new form]= me.openargs

hth
Damon
 
G

Guest

I tried the code you suggested with my field names to no avail. If it helps,
my sales order field is a text field in each table. Does the line for the on
load event stand alone? Like I said before, I am technical in nature but
jsut getting my feet wet with writing/understanding code.

Thanks again for any help!

Damon Heron said:
Openargs should work. What was the problem you were having?
Here is how to do it:

The command button that calls up the form you want:

-enter in the click event-
dim selected as variant 'using variant here because I don't know your
datatype - it could be long?
selected= me.[yoursalesorderfield]
docmd.openform "your formname",acnormal,,,,acdialog, selected

then on the load event of the form you are opening,
me.[yoursalesorderfieldon the new form]= me.openargs

hth
Damon



spcruise said:
I am using Access 2003. I am familiar with the very basics of VBA but I
think my problem can be solved with some help regarding vba and syntax.

We refurbish & recover rollers from paper producing machines at our
facility. I am working on a database that will centralize al the data
that
is generated when the roll comes in for service. Currently each dept
keeps a
record of just what they do. Below is sample production route that I have
simplified:

1. The Roll is recieved and given a unique sales order number.
2. Roll goes through an inspection process.
3. Roll receives a new cover.
4. The new cover is ground to customer specs.
5. Roll is balanced.
6. Roll is shipped to customer.

I have created a main form (roll_data) that is the main screen for
monitoring a roll through the plant. The customer service rep creates a
new
record when received in the roll_data form with basic info for the roll
along
with the customer info and assigns a sales order number. The roll_data
pulls
certain info from the forms listed below for ease of viewing instead of
pulling up every form.

Additional forms include the inspection_form, cover_form, grinding_form,
balance_form and shipping_form. Each form has it's own table using the
sales
order number as the primary key. Each department populates the
appropriate
field with data for the roll. Example: The Grinding dept will populate the
grinding_form and so on. I had to split each process into it's own
form/table due to field limitations in access.

The problem: If I have a roll for sales order 402818 displayed on the
main
form (roll_data) and click one of the links I have to another form
(inspection, cover, grinding, balance, shipping), I want it to pull up the
appropriate form for sales order 402818. Instead, it pulls up the first
record in that table.

I have researched it here and it sounds like I will need to apply some
sort
of filter or where staement to the button to carry the sales order
(primary
key for each table) forward. I have even played with the OpenArgs
statement
with no success.

Please understand that I am an IT person by trade but have not had alot of
experience with actual coding. It has been difficult for me to get out of
my
Excel mindset.

Thanks for any and all help!
 
D

Damon Heron

When you say it didn't work, what exactly happened? Are you familiar with
breakpoints? Did you compile the code (in the VB Window)? Set a breakpoint
at the beginning of the command button click event and follow it thru. Let
me know where it fails.

Damon

spcruise said:
I tried the code you suggested with my field names to no avail. If it
helps,
my sales order field is a text field in each table. Does the line for the
on
load event stand alone? Like I said before, I am technical in nature but
jsut getting my feet wet with writing/understanding code.

Thanks again for any help!

Damon Heron said:
Openargs should work. What was the problem you were having?
Here is how to do it:

The command button that calls up the form you want:

-enter in the click event-
dim selected as variant 'using variant here because I don't know your
datatype - it could be long?
selected= me.[yoursalesorderfield]
docmd.openform "your formname",acnormal,,,,acdialog, selected

then on the load event of the form you are opening,
me.[yoursalesorderfieldon the new form]= me.openargs

hth
Damon



spcruise said:
I am using Access 2003. I am familiar with the very basics of VBA but I
think my problem can be solved with some help regarding vba and syntax.

We refurbish & recover rollers from paper producing machines at our
facility. I am working on a database that will centralize al the data
that
is generated when the roll comes in for service. Currently each dept
keeps a
record of just what they do. Below is sample production route that I
have
simplified:

1. The Roll is recieved and given a unique sales order number.
2. Roll goes through an inspection process.
3. Roll receives a new cover.
4. The new cover is ground to customer specs.
5. Roll is balanced.
6. Roll is shipped to customer.

I have created a main form (roll_data) that is the main screen for
monitoring a roll through the plant. The customer service rep creates
a
new
record when received in the roll_data form with basic info for the roll
along
with the customer info and assigns a sales order number. The roll_data
pulls
certain info from the forms listed below for ease of viewing instead of
pulling up every form.

Additional forms include the inspection_form, cover_form,
grinding_form,
balance_form and shipping_form. Each form has it's own table using the
sales
order number as the primary key. Each department populates the
appropriate
field with data for the roll. Example: The Grinding dept will populate
the
grinding_form and so on. I had to split each process into it's own
form/table due to field limitations in access.

The problem: If I have a roll for sales order 402818 displayed on the
main
form (roll_data) and click one of the links I have to another form
(inspection, cover, grinding, balance, shipping), I want it to pull up
the
appropriate form for sales order 402818. Instead, it pulls up the
first
record in that table.

I have researched it here and it sounds like I will need to apply some
sort
of filter or where staement to the button to carry the sales order
(primary
key for each table) forward. I have even played with the OpenArgs
statement
with no success.

Please understand that I am an IT person by trade but have not had alot
of
experience with actual coding. It has been difficult for me to get out
of
my
Excel mindset.

Thanks for any and all help!
 

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