473,385 Members | 1,464 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,385 software developers and data experts.

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 2783


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...@yahoo.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.Value = 2 Then
strsql = "SELECT ProjectData.* FROM ProjectData WHERE " & _
"([ProjectData].[EngagementSK]= " & [Forms]!
[ClientInformation]![subEngagementInformation].Form!SK & "); "

Me![subProjectInformation].Form.RecordSource = strsql

Me.subProjectInformation.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
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...
6
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....
0
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...
1
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...
2
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...
25
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...
5
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...
1
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...
4
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...
9
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.