JustJerry
04-04-2006, 03:52 PM
I don't even know how to begin asking this, so I'll try to briefly lay out my situation as clear as I can. Basically what is happening is that when I scroll through records via the 'Next' and 'Previous' buttons on my form, I am getting new records inserted into one of my tables.
Main Form (based on Table Main)
Field X (Autonumber)(Primary ID)
Option A (controls which subform to display)
Choice 1
Choice 2
Subform A (based on Table A)
Linked to Main form via Field X
Subform B (based on Table A)
Linked to Main form via Field X
For example, if User selects Choice 1 in the Option A Group box, Subform A is enabled and made visible, Subform B is disabled and hidden.
If user selects Choice 2, Subform A is disabled and hidden, and Subform B is enabled and made visible.
In the Main Form, I have in the 'On Current' event, VBA code that looks at the value in Option A, and displays the correct form. If record is 'New', then both forms are hidden and disabled.
So I created a few test records, as for each record in the Main Form, there can be multiple records for the subforms.
But, for some reason, when I tab through the records on the Main Form, I am getting blank records created in Table A. I do NOT understand why this is happening. Is it because I have two subforms relating to the same table?
Some of the unwanted records in Table A will have the value of Field X(linked field), and some of the records will have a Null Field X.
The reason for the two subforms is that, though they come from the same table, I display different fields depending on the value of Option A that is selected.
At first I was just using the Visible=True/False for the subforms, then I added the Enabled=True/False to see if that would cure the problem, but obvioulsy that was too simple to even work :-)
Any ideas? Am I too vague?
Main Form (based on Table Main)
Field X (Autonumber)(Primary ID)
Option A (controls which subform to display)
Choice 1
Choice 2
Subform A (based on Table A)
Linked to Main form via Field X
Subform B (based on Table A)
Linked to Main form via Field X
For example, if User selects Choice 1 in the Option A Group box, Subform A is enabled and made visible, Subform B is disabled and hidden.
If user selects Choice 2, Subform A is disabled and hidden, and Subform B is enabled and made visible.
In the Main Form, I have in the 'On Current' event, VBA code that looks at the value in Option A, and displays the correct form. If record is 'New', then both forms are hidden and disabled.
So I created a few test records, as for each record in the Main Form, there can be multiple records for the subforms.
But, for some reason, when I tab through the records on the Main Form, I am getting blank records created in Table A. I do NOT understand why this is happening. Is it because I have two subforms relating to the same table?
Some of the unwanted records in Table A will have the value of Field X(linked field), and some of the records will have a Null Field X.
The reason for the two subforms is that, though they come from the same table, I display different fields depending on the value of Option A that is selected.
At first I was just using the Visible=True/False for the subforms, then I added the Enabled=True/False to see if that would cure the problem, but obvioulsy that was too simple to even work :-)
Any ideas? Am I too vague?