[AccessD] Combo Box Question

Kaup, Chester Chester_Kaup at kindermorgan.com
Wed Feb 12 07:22:50 CST 2014


Thanks for the suggestions. I will try them.

-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller
Sent: Wednesday, February 12, 2014 5:47 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Combo Box Question

Chester,

In situations like this, I often make the data source a union query. For
example:

SELECT WellNumber, WellName FROM Wells
UNION
SELECT 0, "All Wells"

At the moment I've forgotten, but I you might need to reverse the order of the SELECT statements to ensure that the "All Wells" value is at the top.
At any rate, then you just use the code as suggested by Steve, and you're good to go.

Arthur


On Wed, Feb 12, 2014 at 3:26 AM, Steve Schapel < steve at datamanagementsolutions.biz> wrote:

> Hi Chester
>
> What is the value of the first (all wells) item in the combobox?  
> Would it work for you to just set that as the Default Value of the 
> combobox, rather than using that Form_Open code?  And would it work 
> for you to just use that to determine the report?  If I understand you 
> correctly, I would not myself favour using the Click event of the combobox to run the report anyway.
> Maybe a little button on the form, to run the report?  That way, the 
> 'all wells' option is the default, otherwise the user selects another 
> item from the combobox.  And your code on the Click event of the 
> command button along the lines of:
>
> Private Sub YourButton_Click()
>    If Me.WellNumber = "all wells" Then        ' (or whatever the value of
> the combobox)
>
>         DoCmd.OpenReport "rpt Set Down All"
>    Else
>         DoCmd.OpenReport "rpt Set Down in a Time Interval"
>    End If
> End Sub
>
> Regards
> Steve
--
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