473,569 Members | 2,383 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Subform Record Problem

have a main form with two tabs, and each tab has a subform. The first
tab's subform refers to the mainform (this works). The second tab's
subform refers to the identity key of the first tab's subform.

I can't get the second subform to show the proper records. I have
used the child and masterlink fields. I have set the recordsource of
the second subform to include the identity key field on the first
subform.

This an accounting system and is running many calculations. If I try
to requery the subform using the oncurrent on the first subform it
crashes. I've tried to set the recordsource in different places and
can't get it to work properly.

The closest I came was to put the recordsource dynamically on the
tabmain code. But that only returned one record in the second subform
instead of all the correct records.

At this point I'm stuck. Any help would be appreciated.

Feb 19 '07 #1
4 2798


How are you setting the Child/Master links between subforms?

Feb 19 '07 #2
Make the subform's recordsource the result of a query. Set the the
query parameter on the matching field main key to subform foreign key.

forms!form1!key _value

in 'criteria' box under the foreign key's column in the query.

Feb 19 '07 #3
On Feb 19, 5:06 pm, "Ecohouse" <ecovinda...@ya hoo.comwrote:
have a main form with two tabs, and each tab has a subform. The first
tab's subform refers to the mainform (this works). The second tab's
subform refers to the identity key of the first tab's subform.

I can't get the second subform to show the proper records. I have
used the child and masterlink fields. I have set the recordsource of
the second subform to include the identity key field on the first
subform.
make an unbound field on the parent form called txtKey

Access hates to use an unbound field as master field, you can do it.
Make txtKey your master field for the second (non-working) subform.
You can't use the wizard to build this relationship, and any time you
try to use the wizard it will clear the relationship.

in the first (working) subform's onCurrent event:
me.parent!txKey = me!txtID
Feb 20 '07 #4
Thanks for all the help. I've tried using all of the suggestions and
none of them work. This form is complicated and runs a lot of
calculations and updates when it moves from record to record and
subform to subform.

I put an unbound field on the main form and it caused the form to
crash. I am using the master-child links also and that returns all
the records.

I've also set the recordsource dynamically. This is the closest I've
come. But the problem is that it only returns one record instead of
all of them. This is the code:

Private Sub TabMain_Change( )

Dim strsql As String

If Me.Dirty Then Me.Dirty = False

If Me.TabMain.Valu e = 2 Then
strsql = "SELECT ProjectData.* FROM ProjectData WHERE " & _
"([ProjectData].[EngagementSK]= " & [Forms]!
[ClientInformati on]![subEngagementIn formation].Form!SK & "); "

Me![subProjectInfor mation].Form.RecordSou rce = strsql

Me.subProjectIn formation.Form. Refresh
End If

I can't use a requery here because it causes the form to crash. Any
other ideas?

End Sub

Feb 20 '07 #5

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

Similar topics

1
3048
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 (frmBookingBookingBased), start a new record, and copy some values form the form into some fields in the subform, and then leave the cursor sitting (in...
6
2028
by: Ray | last post by:
I have a main form with a subform. The main form has a combo box which lists all the clients which in turn are displayed in the subform. The subform is bound to the combo box and all work well. however, I would like to be able to add a new client in the subform but this is, of course bound to the combo box. Can anyone tell me if there is a...
0
8385
by: Carl | last post by:
I have a main form with navigation buttons on it and a label showing for example Record 1 of 15 using recordsetclone on it and eveything works fine. When I move through the records the record number changes fine. Within this main form I have a subform detailing distribution records for the contact (main form is based on this) that also has...
1
680
by: sixsoccer | last post by:
I have built a database with a <Mainform> and a <Subform>. My problem is twofold. 1. My subform is set as a continuos form with AllowAddiotions set to NO (ie. a list of Issues to the client on the mainform) 2. To add new issues, a button is used and a pop-up form is used to add an issue with more detail than what's available on the...
2
2837
by: CSDunn | last post by:
Hello, In an Access 2003 ADP Subform, I am trying to set the BackGround color of three textbox fields (LSScore, RScore, WScore) in the current record of the subform to zero (black) if the value of a bound checkbox field (Spanish) on the current record is True, and to 16777164 if the value of the bound checkbox field is False. The Subform's...
25
10184
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the data in each record, which includes the ID of the father and the mother (who also have records in the table). One record per form. I have a Tab...
5
3363
by: Bob | last post by:
Hi Everybody I have a form called frmListBox that is connected to a table tblListBox. This is opened from a form called "frmInvoiceOrder" which has a subform called "zfrmInvoiceOrder" and floats above (ie is pop-up) ! Private Sub ListBox_DblClick(Cancel As Integer) DoCmd.OpenForm "Forms!!!.Form! = Me!ListBox.Column(1) Forms!!.Form! =...
1
2684
by: kkrizl | last post by:
I have a form that displays general information about an alarm permit location. There's a subform that shows detailed information about burglar alarms that have gone off at the location. When a new alarm is entered on the subform, I want to print a report that shows the general information and the alarms that were entered. The record source...
4
2006
by: aqua404 | last post by:
I know this has been discussed, but I can't find a resolution. I have a subform on a form. The table with the data for the main form has 15,000 records. I am opening and then setting recordsource so as to only pull 1 record. The table where the subform data comes from has 130,000 records. There is a parent/child link. Indexed on those...
9
9674
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a master-child link to the first subform. subform2 - Master Field: subTrainingModule.Form!TrainingModuleTopicSK Child Field: TrainingModuleTopicSK
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7678
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7982
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6286
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5222
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3656
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
944
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.