[AccessD] simple questions: combo box help

Jamie Kriegel jamie at kriegelpcsolutions.com
Thu May 29 08:37:17 CDT 2003


Thanks for the help arthur . . . how do I requery the dependents combo on
subform 2?

Also, I'm wondering if I have this set up properly as far as relationships
go . . .can I email you off list with a print out of my tables and
relationships.  I'd really appreciate your input/opinion as to wether or not
I have them set up properly.

Thanks,
Jamie

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Arthur Fuller
Sent: Thursday, May 29, 2003 7:11 AM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] simple questions: combo box help


I forgot one last thing. In the OnEnter of subform 2, requery the dependents
combo.

Arthur

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller
Sent: May 29, 2003 7:59 AM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] simple questions: combo box help


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

_______________________________________________
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



More information about the AccessD mailing list