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

Subform Sadness

Hi, Hope someone can help me.

I have the following setup in an Access database
A master form 'Customers'
in 'Single Form' view
that has a RecordSource of 'myCustomerTable'
CustomerCode
CustomerName
A subform 'Items'
in 'Datasheet' view
that has a RecordSource of 'myItems'
ItemCode
Qty
CustomerCode

There are no automatic 'Links' set up between the forms, but the 'On
Current' event of the 'Items' form contains the following code:
Form_Customers.Filter = "CustomerCode = " & Me.CustomerCode
Me.FilterOn = True

This works, and causes the Customers form to keep in sync with the
currently selected record in the Items grid. (And yes I know this is a
bit back to front, but please trust me that there are good reasons for
this...)

Given the above, my problem is this. All works fine, unless I try to
change the order of the items form (either by right clicking on the
top of the columns, or by using the OrderBy property of the form) as
soon as I apply the filter on the customers table, I can no longer
move the cursor down the Items form, it is fixed at the top. Also the
order of the Items table reverts to what it was (OrderByOn on the
Items form gets reset to false by the FilterOn on the Customer form).
Can anyone tell me why this happens, and how I can stop it?

This all sounds really complicated, but is actually quite straight
forwards if you try and reproduce it!
Nov 12 '05 #1
2 2732
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The correct way to link a subform to the main form is by the Child and
Master Link properties on the subform. IOW, your subform Items link
properties should be like this:

Link Child Fields: CustomerCode
Link Master Fields: CustomerCode

MGFoster:::mgf
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP8eYpIechKqOuFEgEQJzNgCfSyxEmNfDPhJjqjmLKSJuCW NyMtkAoOld
5Ug1Ihha7E1K5VfXqcOxbilx
=t/Z8
-----END PGP SIGNATURE-----

chrisM wrote:
Hi, Hope someone can help me.

I have the following setup in an Access database
A master form 'Customers'
in 'Single Form' view
that has a RecordSource of 'myCustomerTable'
CustomerCode
CustomerName
A subform 'Items'
in 'Datasheet' view
that has a RecordSource of 'myItems'
ItemCode
Qty
CustomerCode

There are no automatic 'Links' set up between the forms, but the 'On
Current' event of the 'Items' form contains the following code:
Form_Customers.Filter = "CustomerCode = " & Me.CustomerCode
Me.FilterOn = True

This works, and causes the Customers form to keep in sync with the
currently selected record in the Items grid. (And yes I know this is a
bit back to front, but please trust me that there are good reasons for
this...)

Given the above, my problem is this. All works fine, unless I try to
change the order of the items form (either by right clicking on the
top of the columns, or by using the OrderBy property of the form) as
soon as I apply the filter on the customers table, I can no longer
move the cursor down the Items form, it is fixed at the top. Also the
order of the Items table reverts to what it was (OrderByOn on the
Items form gets reset to false by the FilterOn on the Customer form).
Can anyone tell me why this happens, and how I can stop it?

This all sounds really complicated, but is actually quite straight
forwards if you try and reproduce it!

Nov 12 '05 #2
Hi,

Yea, I know that the usual way of linking a subform is to use the
Child/Master link properties, but as I said in my post, there are
reasons for having to do it the way we have. The actual form is pretty
complicated, there are 4 subforms that are all interlinked, and the
Child/Master link is simply not sufficient for our needs in this case.
:-(

Having said that, we have found a solution. Rather than the OnCurrent
event of the subform controlling a Filter on the Customer form, we are
using the following in the subforms OnCurrent:

Form_Cust.RecordSource = "select * from cust where custid = " &
Me.CustID

This is doing the same thing as the filter, but has none of the
strange side-effects.

Regards,

ChrisM

MGFoster <me@privacy.com> wrote in message news:<wM*****************@newsread2.news.pas.earth link.net>...
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The correct way to link a subform to the main form is by the Child and
Master Link properties on the subform. IOW, your subform Items link
properties should be like this:

Link Child Fields: CustomerCode
Link Master Fields: CustomerCode

MGFoster:::mgf
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP8eYpIechKqOuFEgEQJzNgCfSyxEmNfDPhJjqjmLKSJuCW NyMtkAoOld
5Ug1Ihha7E1K5VfXqcOxbilx
=t/Z8
-----END PGP SIGNATURE-----

chrisM wrote:
Hi, Hope someone can help me.

I have the following setup in an Access database
A master form 'Customers'
in 'Single Form' view
that has a RecordSource of 'myCustomerTable'
CustomerCode
CustomerName
A subform 'Items'
in 'Datasheet' view
that has a RecordSource of 'myItems'
ItemCode
Qty
CustomerCode

There are no automatic 'Links' set up between the forms, but the 'On
Current' event of the 'Items' form contains the following code:
Form_Customers.Filter = "CustomerCode = " & Me.CustomerCode
Me.FilterOn = True

This works, and causes the Customers form to keep in sync with the
currently selected record in the Items grid. (And yes I know this is a
bit back to front, but please trust me that there are good reasons for
this...)

Given the above, my problem is this. All works fine, unless I try to
change the order of the items form (either by right clicking on the
top of the columns, or by using the OrderBy property of the form) as
soon as I apply the filter on the customers table, I can no longer
move the cursor down the Items form, it is fixed at the top. Also the
order of the Items table reverts to what it was (OrderByOn on the
Items form gets reset to false by the FilterOn on the Customer form).
Can anyone tell me why this happens, and how I can stop it?

This all sounds really complicated, but is actually quite straight
forwards if you try and reproduce it!

Nov 12 '05 #3

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

Similar topics

15
by: Rey | last post by:
Howdy all. Appreciate your help with several problems I'm having: I'm trying to determine if the Visit subform (subformVisits) has a new record or been changed, i.e. dirty. The form that...
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...
1
by: John Michael | last post by:
I have a form that has a subform that has a subform. The subform loads a record based on a combo lookup box in the main form. I'm trying to set a value in the subform based on a value in a...
4
by: Dave Boyd | last post by:
Hi, I have two very similar forms each with a subform. The main form gets a few fields from the user and passes this back to a query that the subform is bound to. The requery is done when the...
1
by: MP | last post by:
I have a main form that has a subform which also has a subform: the main form is the first subform is the second subform is When I click on the button »AddNewSubSubRecord« (add a new record...
6
by: DMUM via AccessMonster.com | last post by:
Hello I am trying to pass the name of my subform to a function/sub but I can't seem to get it to work. I am using an autokey function (ctrl E) to unlock text boxes on a subform. I have a few...
4
by: Macbane | last post by:
Hi, I have a 'main' form called frmIssues which has a subform control (named linkIssuesDrug) containing the subform sfrmLink_Issues_Drugs. A control button on the main form opens a pop-up form...
7
by: ApexData | last post by:
I am using the following code in my TabControl to manage subform loads. The code assigns the subForms SourceObject. - Do I also need code to DeAssign the SourceObject when leaving the Tab, I'm...
5
by: samdev | last post by:
I have created two combo boxes in a subform.... For example 1. Combo Box State 2. Combo Box City 3. When a state from the Combo Box State is selected, the City combo box updates to reflect...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.