472,378 Members | 1,334 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,378 software developers and data experts.

Form/ subform problems

I have a table (Table A). It has one field, a PK. It is in a 1:M with
another table (Table B). I am having trouble with a form/subform setup
to view the 1:M records.

On the parent form, there is a combo box with a Select query to select
one of the records in Table A. (The parent form is bound to Table A.)
I want to be able to first, view all of the corresponding records from
Table B and then second, give an option for editing these records via
a command button.

My first problem is that when I select a record in the combo box on
the parent form, the corresponding records in the subform don't
appear. I have the parent and child fields linked properly, I think. I
have tried to change my key structure in Table B as well, trying both
a single and a composite key. I thought that when I selected a record
on the main form, the subform automatically populates with the data.
BTW, the subform is in single form display mode, not continuous. Does
this matter when attempting to view many records from Table B? Doesn't
Access create a recordset of all the records in Table B so that I can
view them one at a time with the navigation buttons in the subform?

My second problem is that when I move out of the combo box to a field
on the subform, Access tells me that it can't create a record because
it would create duplicates values in the PK field (Table A). I know
this. I don't want to create a record, I just want to view the
records. I have another form for the creation of a new record and it
works fine. What is the preferred way for opening a form/subform in
view mode only?

Thanks in advance.

Troy Lee
Sep 29 '08 #1
1 3402
tr******@comcast.net wrote:
I have a table (Table A). It has one field, a PK. It is in a 1:M with
another table (Table B). I am having trouble with a form/subform setup
to view the 1:M records.

On the parent form, there is a combo box with a Select query to select
one of the records in Table A. (The parent form is bound to Table A.)
I want to be able to first, view all of the corresponding records from
Table B and then second, give an option for editing these records via
a command button.
Unless you actually intend to edit the single field in tableA you do not
need the main form to be bound. All you really have is a form for selecting
the gropups of records from tableB.

My guess is that you have bound not only the form, but also the ComboBox and
that would be incorrect. When you make a choice in that you are actually
editing the current main record (not what you want I assume).
My first problem is that when I select a record in the combo box on
the parent form, the corresponding records in the subform don't
appear. I have the parent and child fields linked properly, I think. I
have tried to change my key structure in Table B as well, trying both
a single and a composite key. I thought that when I selected a record
on the main form, the subform automatically populates with the data.
BTW, the subform is in single form display mode, not continuous. Does
this matter when attempting to view many records from Table B? Doesn't
Access create a recordset of all the records in Table B so that I can
view them one at a time with the navigation buttons in the subform?

My second problem is that when I move out of the combo box to a field
on the subform, Access tells me that it can't create a record because
it would create duplicates values in the PK field (Table A). I know
this. I don't want to create a record, I just want to view the
records. I have another form for the creation of a new record and it
works fine. What is the preferred way for opening a form/subform in
view mode only?
This confirms that you are editing the current main record and trying to
make its value equal to that of another record in the same table and thus
you ARE trying to make two records have identical keys.

Just remove the RecordSource of the main form and everything will work.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Sep 29 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Max Harvey | last post by:
Hi, I made up a nice little form which had its own sub form in it. I made a litle VB code so that when I pressed a button it would move form the form (frmConference) to the subform...
12
by: swingingming | last post by:
Hi, in the NorthWind sample database, when clicking on the next navigation button on the new order record with nothing on the subform (order details), we got an order with nothing ordered. How can...
4
by: crystal | last post by:
I've checked the threads but haven't been able to come up with a solution to my issue. Help...... I have a simple form based on a table. Within the form is a subform that is also, through a Q,...
2
by: David W. Fenton | last post by:
I think at various times we've all encountered this problem: A subform is on a main form. From the code of the main form we refer to some property of/control on the child form thus: ...
11
by: BobBanks | last post by:
Hi, Im making a db for my company in Access 2003 usin xp sp2. Ive created an orders form that has a subform in it. The Order form (parent(is linked to a Orders Qry)) and the Orders Subform...
11
by: kabradley | last post by:
Hello Everyone, So, thanks to nico's help I was finally able to 'finish' our companies access database. For the past week or so though,I have been designing forms that contain a subform and an...
11
by: mrowe | last post by:
I am using Access 2003. (I am also using ADO in the vast majority of my code. I recently read a post that indicated that ADO is not all that is was initially cracked up to be. In the back of my...
6
by: solom190 | last post by:
Okay this is the situation I have two forms and they have a 1:M relationship. I don't have enough space screen-wise to do a traditional "drag form to form" to create a subform so what I did was...
0
sickenhoofer
by: sickenhoofer | last post by:
I am having some problems with a form and its subforms. It was designed to click on a list of numbers on a subform, which causes another subform's data to change to data relevant to the number...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...
0
by: F22F35 | last post by:
I am a newbie to Access (most programming for that matter). I need help in creating an Access database that keeps the history of each user in a database. For example, a user might have lesson 1 sent...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.