Minggu, 26 Agustus 2012

Re: [MS_AccessPros] How to let contents of one combo box affect contents of another combo box

Thanks Duane!

That was a very good idea! Much better than the clumsy idea I had in mind myself to build a loooong if statement with a number of AND statements that of course would require changes to the VBA code for every new product type appearing in the future.

Regards
Dennis


26 aug 2012 kl. 21:04 skrev Duane Hookom:

> The other key item I expect would be to add a column in the first combo box that identifies whether or not the value is "other product types". Use this column value to determine how to handle the second combo box.
>
> Duane Hookom
> MS Access MVP
>
> ----------------------------------------
> > To: MS_Access_Professionals@yahoogroups.com
> > From: JohnV@msn.com
> > Date: Sun, 26 Aug 2012 19:17:40 +0200
> > Subject: RE: [MS_AccessPros] How to let contents of one combo box affect contents of another combo box
> >
> > Dennis-
> >
> > Well, in the After Update event of "A", if it's not a hotel-related item, set
> > combo B to Null and set Locked = True. You'll also probably need code in the
> > Current event of the form to unlock combo B unless the row already contains a
> > non-hotel event.
> >
> > John Viescas, author
> > Microsoft Office Access 2010 Inside Out
> > Microsoft Office Access 2007 Inside Out
> > Building Microsoft Access Applications
> > Microsoft Office Access 2003 Inside Out
> > SQL Queries for Mere Mortals
> > http://www.viescas.com/
> > (Paris, France)
> >
> >
> >
> >
> > -----Original Message-----
> > From: MS_Access_Professionals@yahoogroups.com
> > [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Dennis Davidsson
> > Sent: Sunday, August 26, 2012 5:56 PM
> > To: MS_Access_Professionals@yahoogroups.com
> > Subject: Re: [MS_AccessPros] How to let contents of one combo box affect
> > contents of another combo box
> >
> > Thanks John,
> >
> > I am not quite sure what level of detail I should give you, but I will try:
> > The combo boxes are actually part of a subform for order details. The outer
> > order form is used to register basically hotel bookings, and the combo box B in
> > my mail is used to present the available alternatives of hotel names, and the
> > combo box A presents a list of available types of rooms, like double room,
> > single room, extra bed, etc.
> > However, there are also other "product types", that may be ordered on an order
> > detail line like e.g. dinner, sightseeing tickets, program catalog, etc. And for
> > those types there is no connection to a specific hotel name. So for those cases
> > I want the program to fill in a default value indicating there is no hotel
> > involved. And thus making it possible for the keying user to just skip that box
> > and continue to the remaining relevant boxes on the order detail line. The data
> > source behind the combo box B is simply a table containing all available hotel
> > names and a number as primary key.
> >
> > Well that was trial to give some more details.
> > Hope you have got the picture now roughly.
> >
> > regards
> > Dennis
> >
> >
> > 26 aug 2012 kl. 17:19 skrev John Viescas:
> >
> > > Dennis-
> > >
> > > Yes, you could certainly do that in the After Update event of the first combo
> > > using VBA. Would need more details before I can give you sample code.
> > >
> > > John Viescas, author
> > > Microsoft Office Access 2010 Inside Out
> > > Microsoft Office Access 2007 Inside Out
> > > Building Microsoft Access Applications
> > > Microsoft Office Access 2003 Inside Out
> > > SQL Queries for Mere Mortals
> > > http://www.viescas.com/
> > > (Paris, France)
> > >
> > > -----Original Message-----
> > > From: MS_Access_Professionals@yahoogroups.com
> > > [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Dennis Davidsson
> > > Sent: Sunday, August 26, 2012 3:26 PM
> > > To: MS_Access_Professionals@yahoogroups.com
> > > Subject: [MS_AccessPros] How to let contents of one combo box affect contents
> > of
> > > another combo box
> > >
> > > Hello,
> > >
> > > I have a form containing a combo box A and another combo box B. Depending on
> > > what the user selects from the available alternatives in combo box A, I want
> > the
> > > code to force a certain choice among the alternatives in combo box B without
> > the
> > > user having to select the combo box B at all.
> > > Could I achieve this by adding some smart VBA code e.g. on the 'After Update'
> > > event of the combo box A?
> > > Or is there some other better way?
> > >
> > > Regards
> > > Dennis Davidsson
> > >
> > > [Non-text portions of this message have been removed]
> > >
> > > ------------------------------------
> > >
> > > Yahoo! Groups Links
> > >
> > >
> >
> >
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> > ------------------------------------
> >
> > Yahoo! Groups Links
> >
> >
> >
>



[Non-text portions of this message have been removed]



------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/MS_Access_Professionals/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/MS_Access_Professionals/join
(Yahoo! ID required)

<*> To change settings via email:
MS_Access_Professionals-digest@yahoogroups.com
MS_Access_Professionals-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
MS_Access_Professionals-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/

Tidak ada komentar:

Posting Komentar