bcooler
Programmer
- Jun 13, 2009
- 132
OK, I'm about 15 hours into this problem....AGGHH!
I have a form called "frmEval" with a combobox called "cboRMA" and a subform (control name is "sfrmRecall") which was created using the subform wizard.
Ultimately, I'd like the subform to update as I change the combobox. I thought this would happen automatically and without VBA, but maybe not.
There are 2 scenarios I've come up with to requery the subform after the combobox change.
SCENARIO 1: If I open the form (from the switchboard button) in an attempt to create a NEW record with
DoCmd.OpenForm "frmEval", acNormal, , , , , "Eval_Start"
Forms("frmEval").DataEntry = True
OR
DoCmd.OpenForm "frmEval",acNormal, , ,acFormAdd, , "Eval_Start"
then I correctly open with a new record. However, any changes to the combobox do not result in subform changes, even when using Forms![frmEval]![sfrmRecall].Requery in my "cboRMA_AfterUpdate()" event.
I then began using a Me.Requery in the same "cboRMA_AfterUpdate()" event to requery the whole form, but I believe Access is creating a new record at this time because my combobox disappears and the record number changes to "new", and multiple records are showing up in the related table (I think due to my new record requirement in the openform command).
SCENARIO 2: I open the form using
DoCmd.OpenForm "frmEval", acNormal, , , , , "Eval_Start"
PLUS
DoCmd.GoToRecord , "", acNewRec
PLUS
Me.Requery in the "cboRMA_AfterUpdate()" event
which seems to work for the first form that I enter. Within this instance of the form opening, I can change the cboRMA combobox and the subform will update correctly. When I close the form and try another entry (from the switchboard), modification of another combo box I enter (called cboContr) tied to a "ME.Requery", causes the previous record's data to enter into all other boxes on the form. I'm afraid the operator won't modify to correct. I don't know why the form is remembering the previous data?
Sorry for the long post, but I need answers to to the following:
a) What do I do to get the subform to update when the combobox changes? I'm afraid the more code I put in, the more likely it will fail for a scenario I haven't considered.
b) Why doesn't the subform automatically update when I am changing the "master" table via combobox change?
P.S- I've tried a lot of things that I've seen posted such as
1) Refresh or Repaint instead of Requery
2) Making sure I reference the correct subform control when requerying (I use the autofill from VB)
3) Placing a messagebox on either side of the query to see the cboRMA change from "Null" to the previous record's data. HUH???
Thanks again. The prize for a good solution is my pulled out hair sent to your address. I'm sure you could make a small toupee by now.
I have a form called "frmEval" with a combobox called "cboRMA" and a subform (control name is "sfrmRecall") which was created using the subform wizard.
Ultimately, I'd like the subform to update as I change the combobox. I thought this would happen automatically and without VBA, but maybe not.
There are 2 scenarios I've come up with to requery the subform after the combobox change.
SCENARIO 1: If I open the form (from the switchboard button) in an attempt to create a NEW record with
DoCmd.OpenForm "frmEval", acNormal, , , , , "Eval_Start"
Forms("frmEval").DataEntry = True
OR
DoCmd.OpenForm "frmEval",acNormal, , ,acFormAdd, , "Eval_Start"
then I correctly open with a new record. However, any changes to the combobox do not result in subform changes, even when using Forms![frmEval]![sfrmRecall].Requery in my "cboRMA_AfterUpdate()" event.
I then began using a Me.Requery in the same "cboRMA_AfterUpdate()" event to requery the whole form, but I believe Access is creating a new record at this time because my combobox disappears and the record number changes to "new", and multiple records are showing up in the related table (I think due to my new record requirement in the openform command).
SCENARIO 2: I open the form using
DoCmd.OpenForm "frmEval", acNormal, , , , , "Eval_Start"
PLUS
DoCmd.GoToRecord , "", acNewRec
PLUS
Me.Requery in the "cboRMA_AfterUpdate()" event
which seems to work for the first form that I enter. Within this instance of the form opening, I can change the cboRMA combobox and the subform will update correctly. When I close the form and try another entry (from the switchboard), modification of another combo box I enter (called cboContr) tied to a "ME.Requery", causes the previous record's data to enter into all other boxes on the form. I'm afraid the operator won't modify to correct. I don't know why the form is remembering the previous data?
Sorry for the long post, but I need answers to to the following:
a) What do I do to get the subform to update when the combobox changes? I'm afraid the more code I put in, the more likely it will fail for a scenario I haven't considered.
b) Why doesn't the subform automatically update when I am changing the "master" table via combobox change?
P.S- I've tried a lot of things that I've seen posted such as
1) Refresh or Repaint instead of Requery
2) Making sure I reference the correct subform control when requerying (I use the autofill from VB)
3) Placing a messagebox on either side of the query to see the cboRMA change from "Null" to the previous record's data. HUH???
Thanks again. The prize for a good solution is my pulled out hair sent to your address. I'm sure you could make a small toupee by now.