PC Review


Reply
Thread Tools Rate Thread

adding new rec on bound form causes unbound listbox woes

 
 
Beth F.
Guest
Posts: n/a
 
      16th Oct 2006
Hi all,
Using Access 2000. This is the first time I've worked with bound
forms, so kindly excuse my naivete/improper terminology if possible.

I have a form that is bound to a table. Also on the form are several
unbound listboxes that will force the user into choosing a valid value
when they update a record or add a new one. All of the text boxes and
listboxes are disabled until the user clicks the New Record or Update
Record buttons (the user is allowed to scroll through existing records,
but cannot get into any fields unless they click New or Update).
When the user opens the form and clicks on the "New Record" button
(which does DoCmd.GoToRecord , , acNewRec), they get a new record with
enabled fields, and they can either save the record (provided it passes
some checks), or click the cancel button, which does a me.undo. This
works fine if this is the very first thing the user does upon opening
the form.

If the user has updated any existing records, things fall apart on
subsequent "New Record" operations. When they go to add the new
record, all of the text boxes on the form are empty (good), and the
listboxes have no selections (also good) _UNTIL_ they type a single
character in any of the textboxes on the form. At that point, the
listboxes on the form become highlighted (selected) with whatever
values the prior record contained. I doubt this matters, but these
listboxes only become visible after the user clicks the New Record or
Update Record button.

After I do the DoCmd.GoToRecord , , acNewRec, I explicitly clear out
the listboxes so no values are selected. But the instant the user
types a character (KeyPress event) in any text box, the above happens.
What I WANT to happen is for the listboxes to remain unselected until
the user selects something. How can I implement this?

Thanks,
Beth F.

 
Reply With Quote
 
 
 
 
Beth F.
Guest
Posts: n/a
 
      17th Oct 2006
I found the solution; in case it helps someone else here it is:
On a new record, I was looping through those unbound listboxes and
setting .selected = False, but what I really needed to do was set the
listbox value to null.

Thanks to everyone who posts and answers here. Though I stumbled upon
my own solution this time, the number of times I've been helped by
previous posts is countless.

Beth F.

Beth F. wrote:
> Hi all,
> Using Access 2000. This is the first time I've worked with bound
> forms, so kindly excuse my naivete/improper terminology if possible.
>
> I have a form that is bound to a table. Also on the form are several
> unbound listboxes that will force the user into choosing a valid value
> when they update a record or add a new one. All of the text boxes and
> listboxes are disabled until the user clicks the New Record or Update
> Record buttons (the user is allowed to scroll through existing records,
> but cannot get into any fields unless they click New or Update).
> When the user opens the form and clicks on the "New Record" button
> (which does DoCmd.GoToRecord , , acNewRec), they get a new record with
> enabled fields, and they can either save the record (provided it passes
> some checks), or click the cancel button, which does a me.undo. This
> works fine if this is the very first thing the user does upon opening
> the form.
>
> If the user has updated any existing records, things fall apart on
> subsequent "New Record" operations. When they go to add the new
> record, all of the text boxes on the form are empty (good), and the
> listboxes have no selections (also good) _UNTIL_ they type a single
> character in any of the textboxes on the form. At that point, the
> listboxes on the form become highlighted (selected) with whatever
> values the prior record contained. I doubt this matters, but these
> listboxes only become visible after the user clicks the New Record or
> Update Record button.
>
> After I do the DoCmd.GoToRecord , , acNewRec, I explicitly clear out
> the listboxes so no values are selected. But the instant the user
> types a character (KeyPress event) in any text box, the above happens.
> What I WANT to happen is for the listboxes to remain unselected until
> the user selects something. How can I implement this?
>
> Thanks,
> Beth F.


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding an unbound - row to a specific index - datagridview bound mode inpuarg Microsoft C# .NET 2 12th Jan 2006 03:27 PM
RE: Insert unbound item in bound listbox =?Utf-8?B?RG90TmV0TWFuaWFj?= Microsoft Dot NET Framework Forms 0 23rd Sep 2004 05:15 PM
Insert unbound item in bound listbox =?Utf-8?B?V2FkZQ==?= Microsoft Dot NET Framework Forms 0 22nd Sep 2004 05:11 PM
How to bound an unbound listbox Kevin Mayer Microsoft Outlook Form Programming 2 13th Dec 2003 10:12 PM
Listbox select record bound or unbound? and how to limit edit of data? Darryn Microsoft Access Forms 2 14th Oct 2003 10:25 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:04 AM.