Arthur Fuller
artful at rogers.com
Thu May 29 06:59:09 CDT 2003
Presumably there's a table called Dependents that houses all the policy
holders' dependents, and contains a column for PolicyHolderID. In that case,
the query that populates the dependents combo box needs to observe the
current policy holder. There are a few ways to do this. My approach is to
keep everything as clean as possible, so I'd use a static function and call
it from the master form's OnCurrent event.
Here is the template I use for creating static functions:
Static Function CurrentX(Optional lngNew As Long) As Long
'Copy this template each time you need a new set/get function 'Then Replace
"X" with the name of your object, i.e.,"Employee" 'Replace all in current
proc and you're done.
Dim lngCurrent As Long
If lngNew <> 0 Then lngCurrent = lngNew
CurrentX = lngCurrent
End Function
So you'd make something like this:
Static Function CurrentPolicyHolder(Optional lngNew As Long) As Long
Dim lngCurrent As Long
If lngNew <> 0 Then lngCurrent = lngNew
CurrentPolicyHolder = lngCurrent
End Function
In the master form's OnCurrent event, just write this:
CurrentPolicyHolder(Me.PolicyHolderID) 'adjust the name to suit
Then modify your query to reference the function:
Select DependentID, DependentName From Dependents Where PolicyHolder =
CurrentPolicyHolder()
That should work as you want.
Hth,
Arthur
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mike and Doris
Manning
Sent: May 29, 2003 7:45 AM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] simple questions: combo box help
Does the table your dependent list is pulled from have some field that links
it to the policy holder? If it does, then just use a reference to a control
on the main form that holds that connecting information in the query for the
dependent combobox. If not, then you have a big problem.
Doris Manning
Database Administrator
Hargrove Inc.
www.hargroveinc.com
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jamie Kriegel
Sent: Thursday, May 29, 2003 2:02 AM
To: Accessd at Databaseadvisors.Com
Subject: [AccessD] simple questions: combo box help
Hi Everyone,
I have what I hope is a very simple question. I have a form with a
subreport (actually two subreports). This form is used in an insurance
database. The first main form lists policy holder info, subform 1 lists all
policies that this particular customer has (auto, life, home, etc.) and
subform 2 list all dependents on whatever policy is in subform 1 (e.g.
subform 1 lists auto policy and subform 2 shows that the policy holder's
wife and son are also on this policy.) Anyway, on subform 2 I have a combo
box where I want to pick the dependent's name (if I'm adding a dependent to
a policy.) My only problem is, the combo box lists EVERY dependent in my
database. How do I filter this combo box to only show the policy holder's
dependents?
Any help would be GREATLY appreciated!
Thanks,
Jamie
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com