Re: Delete From ComboBox
From: DatabaseBob (DatabaseBob_at_discussions.microsoft.com)
Date: 12/29/04
- Next message: Michael E. Hill: "Command Button - 1 Click Runs Code 3 Times"
- Previous message: Database Dummy: "Re: What does this mean?- in English"
- In reply to: Dirk Goldgar: "Re: Delete From ComboBox"
- Next in thread: Dirk Goldgar: "Re: Delete From ComboBox"
- Reply: Dirk Goldgar: "Re: Delete From ComboBox"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 29 Dec 2004 10:01:05 -0800
Dirk,
Thanks for the reply. I'd like to delete the form record. It's a
continuous forms subform with 3 fields on it, one of which is the combo. I
want it to happen when the user blanks the entire value out (and makes the
combo value Null) where it had a value previously. The combo is bound to a
table field that is part of the form's recordset. Since I want the form's
record to be deleted, the bound value would go with it. The recordsource for
the combo would be unaffected.
This IS the behaviour the users expect. The combo is the only required
field on the form and when they remove its value they expect the record to
dissappear.
"Dirk Goldgar" wrote:
> "DatabaseBob" <DatabaseBob@discussions.microsoft.com> wrote in message
> news:E35AC629-EF9E-4EF5-9572-E98A5BD48C01@microsoft.com
> > Greetings,
> > Access 97, combo box recordsource is 2 columns from a table.
> > LimitToList is True.
> >
> > I'd like to allow users to hit the Delete key while focus is on my
> > combo and hit Tab or Enter. I want to trap the appropriate event
> > with code to prompt if they really want to delete the record (I can
> > take it from there if I get that far). I also want them to be able
> > to use the NotInList event to prompt/add records to the combo
> > recordsource if they type in a new entry. That code is already in
> > place.
> >
> > Problem is that, as soon as I Tab away from the combo with the entry
> > deleted, I get runtime error 3162, "Can't assign a Null value..."
> > I've tried to capture a Null in the box value with BeforeUpdate, but
> > apparently NotInList happens first and the "NewData" argument in that
> > proc is predefined as as String (which I believe is what's causing
> > the error).
> >
> > The only way I've been able to get this to work is a workaround I'm a
> > bit uncomfortable with - to capture the error in the Form's error
> > event, bypass it and then run my code for the prompt/delete. If this
> > error occurs for any other reason than my design I'll have problems.
> >
> > Any ideas on this would be appreaciated!
>
> What record is it you're wanting to delete? The current record of the
> form, or the record in the combo box's rowsource table that corresponds
> to the value shown in the combo box?
>
> Do want this process to happen when the user deletes the entire value
> shown in the combo box, or should they just have to hit the Delete key
> any time they are in the combo box (and what then if they want to edit
> the value and delete a character from the middle of it)?
>
> Is this a bound combo box? If so, what should become of the bound field
> when you delete its value from the combo's rowsource?
>
> You're messing with the normal Windows user interface here, which may
> not be such a great idea if users don't expect the behavior you
> implement.
>
> --
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
>
> (please reply to the newsgroup)
>
>
>
- Next message: Michael E. Hill: "Command Button - 1 Click Runs Code 3 Times"
- Previous message: Database Dummy: "Re: What does this mean?- in English"
- In reply to: Dirk Goldgar: "Re: Delete From ComboBox"
- Next in thread: Dirk Goldgar: "Re: Delete From ComboBox"
- Reply: Dirk Goldgar: "Re: Delete From ComboBox"
- Messages sorted by: [ date ] [ thread ]