Opening Second Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a database that I inherited. There is a problem with the forms. I
have a main form that you populated with say 5 pieces of data that feeds a
table. Then further down on this form there is a pull down which has the
values "high, medium, or low". After you select one of the values you hit a
button and a new form pops up to enter some more specific data (if you
selected "low" a form for low appears where you put some other data in, if
you select "medium" a form for medium info pops up, etc.) This is the issue,
when I open the second form (based on the "low medium or high" selection) it
takes me to the beginning record in the table. (All the forms feed the same
table). So lets say I am working on record 16. I fill in my basic
information. Then I select "low" to take me to the "low" form. Once I am
there, the form is on record 1, not record 16. I need to find a way to be
able to select from my combo box "low", "medium", or "high" and then when I
hit the button to open the corresponding form it keeps me in the same record.
I dont know why it was created this way but it was. Can someone just help
me get the second forms to stay with the current record I am working on? All
the data resides in the same table it is just the forms are getting screwed
up! TIA!
 
You need to add a where condition to your open form action

DoCmd.OpenForm "FormName", , , "[ControlName]=" & Me![ControlName]

The control name needs to be the contol that hold the primary key. If the
primary key is an autonumber, you will have to perform a save operation
before the open form.
 
On the info you provided, I am curious about "form Name". The form name is
different based on what the combo box is set to. Should I use the combobox
control as the form name? (The combo box selection opens 1 of 3 forms) -
High, Medium or Low...
TIA!

schasteen said:
You need to add a where condition to your open form action

DoCmd.OpenForm "FormName", , , "[ControlName]=" & Me![ControlName]

The control name needs to be the contol that hold the primary key. If the
primary key is an autonumber, you will have to perform a save operation
before the open form.


Jenn said:
I have a database that I inherited. There is a problem with the forms. I
have a main form that you populated with say 5 pieces of data that feeds a
table. Then further down on this form there is a pull down which has the
values "high, medium, or low". After you select one of the values you hit a
button and a new form pops up to enter some more specific data (if you
selected "low" a form for low appears where you put some other data in, if
you select "medium" a form for medium info pops up, etc.) This is the issue,
when I open the second form (based on the "low medium or high" selection) it
takes me to the beginning record in the table. (All the forms feed the same
table). So lets say I am working on record 16. I fill in my basic
information. Then I select "low" to take me to the "low" form. Once I am
there, the form is on record 1, not record 16. I need to find a way to be
able to select from my combo box "low", "medium", or "high" and then when I
hit the button to open the corresponding form it keeps me in the same record.
I dont know why it was created this way but it was. Can someone just help
me get the second forms to stay with the current record I am working on? All
the data resides in the same table it is just the forms are getting screwed
up! TIA!
 
If the value of the combobox is the name of the form.

DoCmd.OpenForm Me![ComboBoxName], , , "[ControlName]=" & Me![ControlName]

Jenn said:
On the info you provided, I am curious about "form Name". The form name is
different based on what the combo box is set to. Should I use the combobox
control as the form name? (The combo box selection opens 1 of 3 forms) -
High, Medium or Low...
TIA!

schasteen said:
You need to add a where condition to your open form action

DoCmd.OpenForm "FormName", , , "[ControlName]=" & Me![ControlName]

The control name needs to be the contol that hold the primary key. If the
primary key is an autonumber, you will have to perform a save operation
before the open form.


Jenn said:
I have a database that I inherited. There is a problem with the forms. I
have a main form that you populated with say 5 pieces of data that feeds a
table. Then further down on this form there is a pull down which has the
values "high, medium, or low". After you select one of the values you hit a
button and a new form pops up to enter some more specific data (if you
selected "low" a form for low appears where you put some other data in, if
you select "medium" a form for medium info pops up, etc.) This is the issue,
when I open the second form (based on the "low medium or high" selection) it
takes me to the beginning record in the table. (All the forms feed the same
table). So lets say I am working on record 16. I fill in my basic
information. Then I select "low" to take me to the "low" form. Once I am
there, the form is on record 1, not record 16. I need to find a way to be
able to select from my combo box "low", "medium", or "high" and then when I
hit the button to open the corresponding form it keeps me in the same record.
I dont know why it was created this way but it was. Can someone just help
me get the second forms to stay with the current record I am working on? All
the data resides in the same table it is just the forms are getting screwed
up! TIA!
 
That should work. I appreciate the fast response. Thanks for your help!

schasteen said:
If the value of the combobox is the name of the form.

DoCmd.OpenForm Me![ComboBoxName], , , "[ControlName]=" & Me![ControlName]

Jenn said:
On the info you provided, I am curious about "form Name". The form name is
different based on what the combo box is set to. Should I use the combobox
control as the form name? (The combo box selection opens 1 of 3 forms) -
High, Medium or Low...
TIA!

schasteen said:
You need to add a where condition to your open form action

DoCmd.OpenForm "FormName", , , "[ControlName]=" & Me![ControlName]

The control name needs to be the contol that hold the primary key. If the
primary key is an autonumber, you will have to perform a save operation
before the open form.


:

I have a database that I inherited. There is a problem with the forms. I
have a main form that you populated with say 5 pieces of data that feeds a
table. Then further down on this form there is a pull down which has the
values "high, medium, or low". After you select one of the values you hit a
button and a new form pops up to enter some more specific data (if you
selected "low" a form for low appears where you put some other data in, if
you select "medium" a form for medium info pops up, etc.) This is the issue,
when I open the second form (based on the "low medium or high" selection) it
takes me to the beginning record in the table. (All the forms feed the same
table). So lets say I am working on record 16. I fill in my basic
information. Then I select "low" to take me to the "low" form. Once I am
there, the form is on record 1, not record 16. I need to find a way to be
able to select from my combo box "low", "medium", or "high" and then when I
hit the button to open the corresponding form it keeps me in the same record.
I dont know why it was created this way but it was. Can someone just help
me get the second forms to stay with the current record I am working on? All
the data resides in the same table it is just the forms are getting screwed
up! TIA!
 
No problem

Jenn said:
That should work. I appreciate the fast response. Thanks for your help!

schasteen said:
If the value of the combobox is the name of the form.

DoCmd.OpenForm Me![ComboBoxName], , , "[ControlName]=" & Me![ControlName]

Jenn said:
On the info you provided, I am curious about "form Name". The form name is
different based on what the combo box is set to. Should I use the combobox
control as the form name? (The combo box selection opens 1 of 3 forms) -
High, Medium or Low...
TIA!

:

You need to add a where condition to your open form action

DoCmd.OpenForm "FormName", , , "[ControlName]=" & Me![ControlName]

The control name needs to be the contol that hold the primary key. If the
primary key is an autonumber, you will have to perform a save operation
before the open form.


:

I have a database that I inherited. There is a problem with the forms. I
have a main form that you populated with say 5 pieces of data that feeds a
table. Then further down on this form there is a pull down which has the
values "high, medium, or low". After you select one of the values you hit a
button and a new form pops up to enter some more specific data (if you
selected "low" a form for low appears where you put some other data in, if
you select "medium" a form for medium info pops up, etc.) This is the issue,
when I open the second form (based on the "low medium or high" selection) it
takes me to the beginning record in the table. (All the forms feed the same
table). So lets say I am working on record 16. I fill in my basic
information. Then I select "low" to take me to the "low" form. Once I am
there, the form is on record 1, not record 16. I need to find a way to be
able to select from my combo box "low", "medium", or "high" and then when I
hit the button to open the corresponding form it keeps me in the same record.
I dont know why it was created this way but it was. Can someone just help
me get the second forms to stay with the current record I am working on? All
the data resides in the same table it is just the forms are getting screwed
up! TIA!
 

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

Back
Top