Re: dual use of combo box
From: Roger Carlson (NO-carlsoro-SPAM_at_hotmail.com)
Date: 03/11/04
- Next message: anonymous_at_discussions.microsoft.com: "If Statement in Subform"
- Previous message: lynn atkinson: "combo box query"
- In reply to: Graham R Seach: "Re: dual use of combo box"
- Next in thread: Randall Arnold: "Re: dual use of combo box"
- Reply: Randall Arnold: "Re: dual use of combo box"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 11 Mar 2004 08:17:20 -0500
Your method IS more elegant -- in the old-time programming sense: the fewest
lines of code to produce the desired effect. I use it myself quite often.
But giving answers in the newsgroups, I always err on the side of
understandability (if that's a word). The IF statement is more readily
understood than flipping boolean expressions. Especially for new
programmers. For the similar reasons, I usually use 'IF varBoolean = True'
rather than 'IF varBoolean'.
-- --Roger Carlson www.rogersaccesslibrary.com Reply to: Roger dot Carlson at Spectrum-Health dot Org "Graham R Seach" <gseach@NOSPAMpacificdb.com.au> wrote in message news:%23xw$8rwBEHA.3132@TK2MSFTNGP11.phx.gbl... > Randall, > > There's certainly nothing wrong with Roger's suggestion. If by "elegant" you > mean "complex", then I think you're on the wrong path. Roger's solution is > elegant in my opinion, because it provides the required functionality in a > very simple and manageable way. The only thing I would change, and this is > simply a matter of personal preference, is to do the assignment like this: > cboChooseCombo.Visible = Not (Me.NewRecord) > cboEnterCombo.Visible = (Me.NewRecord) > > Regards, > Graham R Seach > Microsoft Access MVP > Sydney, Australia > > "Randall Arnold" <rgarnold@cathartis.com_> wrote in message > news:O6ykaJuBEHA.2796@TK2MSFTNGP09.phx.gbl... > > That's certainly a workable method. I was just hoping for something more > > "elegant" (sorry...lol). I figured I could change properties on the fly > if > > nothing else-- if I only knew what to change that would work. > > > > For now I'll implement your idea, though. Thanks! > > > > Randall Arnold > > > > "Roger Carlson" <NO-carlsoro-SPAM@hotmail.com> wrote in message > > news:ufG8%23jtBEHA.3796@TK2MSFTNGP10.phx.gbl... > > >I would create two combo boxes, one to find an existing record > > > (cboChooseCombo) and another to add new values (cboEnterCombo). Then > make > > > them alternately visible and invisible depending on whether you are in > the > > > NewRecord of the form. If you placed them one on top of the other and > > > sized > > > them exactly the same, it would look like the same combo had dual roles. > > > > > > It would require something like the following code in the On Current > event > > > of the form. > > > > > > Private Sub Form_Current() > > > If Me.NewRecord Then > > > cboChooseCombo.Visible = False > > > cboEnterCombo.Visible = True > > > Else > > > cboChooseCombo.Visible = True > > > cboEnterCombo.Visible = False > > > End If > > > End Sub > > > > > > -- > > > --Roger Carlson > > > www.rogersaccesslibrary.com > > > Reply to: Roger dot Carlson at Spectrum-Health dot Org > > > > > > "Randall Arnold" <rgarnold@cathartis.com_> wrote in message > > > news:e7yBtRtBEHA.2828@TK2MSFTNGP10.phx.gbl... > > >> I'm going nuts on this one. > > >> > > >> My client wants to use a combo box to filter certain records on a form > > > while > > >> in record Edit mode, and use the same combo to select a value to add to > a > > >> new record while in record Add mode. My assumption was that I could > test > > > to > > >> see if an Add operation was in progress and allow the field value to > > > change > > >> if so; otherwise, I would Cancel the change in the form's BeforeUpdate > > > event > > >> (since in Edit mode I want to use the combo *solely* for filtering of > > >> records-- the field value should never be changed on this form). > > > Naturally, > > >> the combo is bound so that adding records is automatic and browsing the > > >> records in Edit mode shows the proper field value. > > >> > > >> Problem is, this idea doesn't work. The program crashes on the filter > > >> (in > > >> the combo's change event sub) and says I'm trying to access a property > > >> "|" > > >> (!!!???!!!) that doesn't exist. > > >> > > >> Surely someone has done this before, but I can't find any examples. > > > Anyone > > >> know a resource to steer me toward? Many thanks! > > >> > > >> Randall Arnold > > >> > > >> > > > > > > > > > > > >
- Next message: anonymous_at_discussions.microsoft.com: "If Statement in Subform"
- Previous message: lynn atkinson: "combo box query"
- In reply to: Graham R Seach: "Re: dual use of combo box"
- Next in thread: Randall Arnold: "Re: dual use of combo box"
- Reply: Randall Arnold: "Re: dual use of combo box"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|