473,378 Members | 1,383 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,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 3562
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.