Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / November 2006

Tip: Looking for answers? Try searching our database.

Double click on ComboBox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
iwasinnihon - 29 Nov 2006 17:49 GMT
I really appreciate everyone's help.  This board has been extremely
helpful.  I have really learned a lot.

I have a form that has a list box that displays all the information in
a table.  Under the list box are fields that you can enter in
information click a button and it will input the information in the
fields into the table and refresh the list box.  What I want is to be
able to double click on an item in the list box and have it populate
the fields below with that information so that it can be updated.  Then
be able to click a button and have it update the table and refresh the
box and clear the fields.
Steve Schapel - 29 Nov 2006 18:21 GMT
iwasinnihon,

First of all, it will help to clarify communication to remember that
forms do not have fields.  Forms have controls, and tables and queries
have fields.  Sorry, I don't mean the be pedantic, but we can easily get
confused when discussing such topics.

So, can you let us know whether the controls (textboxes etc) on the form
are bound to fields in a table?  In other words, if you look at the
Properties of a textbox on the form, is there the name of a field
entered in the Control Source property?  When you say "click a button
and it will input the information in the fields into the table", are you
able to say by what mechanism this occurs?  Is there macro or code on
the button's Click event that runs an Append Query or some such?  Just
trying to understand what you're working with there.

In any case, I would advise against using the Dbl Click event of a
listbox for such a purpose.  Seems awkward.  Possibly the After Update
evernt, but probably best to select the item you want in the listbox,
and then have another command button to find the associated record.  But
how to do that will depend on your answers to the other questions about
bound/unbound etc.  Thanks.

Signature

Steve Schapel, Microsoft Access MVP

> I really appreciate everyone's help.  This board has been extremely
> helpful.  I have really learned a lot.
[quoted text clipped - 7 lines]
> be able to click a button and have it update the table and refresh the
> box and clear the fields.
iwasinnihon - 29 Nov 2006 20:22 GMT
The controls are all bound to fields in a table.  When you click on the
button it adds the information in the controls to the table.  I didn't
write any code for it.  I used the wizard to create the form.

> iwasinnihon,
>
[quoted text clipped - 33 lines]
> > be able to click a button and have it update the table and refresh the
> > box and clear the fields.
Steve Schapel - 29 Nov 2006 20:40 GMT
iwasinnihon,

Ok, thanks.  So what does clicking on the button actually do?  If the
controls are bound, then clicking the button doesn't actually adds the
information in the controls to the table.  I wouold guess it either
closes the form, or moves to a new record?

As for the listbox (the subject header of your message says combobox,
whereas in the description you say listbox, so I will take it to be a
listbox - is that right?), I gather that this is unbound (i.e. no
Control Source) - is that right?  Can you look at the Properties of the
listbox, and let us know what it has for these properties:
 Row Source
 Column Count
 Bound Column
 Column Widths

Signature

Steve Schapel, Microsoft Access MVP

> The controls are all bound to fields in a table.  When you click on the
> button it adds the information in the controls to the table.  I didn't
> write any code for it.  I used the wizard to create the form.
iwasinnihon - 29 Nov 2006 21:30 GMT
The button refreshes the list box and clears the controls for a new
record.
Here are the properties that you wanted

Control Source is blank

Row Source
SELECT Software.SoftwareID, Software.Title, Software.Platform,
Software.Maker, Software.KeyCode, Software.TotalLicensesCount,
Software.Price, Software.[MediaCD/DVD], Software.PurchaseDate FROM
Software ORDER BY [Title];

Column Count
8

Bound Column
1

Column Widths
0";1";1";1";1";1";1";1";1"

> iwasinnihon,
>
[quoted text clipped - 19 lines]
> > button it adds the information in the controls to the table.  I didn't
> > write any code for it.  I used the wizard to create the form.
Steve Schapel - 29 Nov 2006 21:49 GMT
iwasinnihon,

Ok, on the basis of the information I have so far, it seems to me that
you could put code similar to this on the Click event of a button, and
run it after selecting an item in the listbox...

 Me.SoftwareID.SetFocus
 DoCmd.FindRecord Me.NameOfListbox

(substitute actual name of listbox).

Let us know how you get on with this.

Signature

Steve Schapel, Microsoft Access MVP

> The button refreshes the list box and clears the controls for a new
> record.
[quoted text clipped - 40 lines]
>>> button it adds the information in the controls to the table.  I didn't
>>> write any code for it.  I used the wizard to create the form.
iwasinnihon - 29 Nov 2006 22:57 GMT
When I try that I get the following error

You can't use Find or Replace now.

> iwasinnihon,
>
[quoted text clipped - 56 lines]
> >>> button it adds the information in the controls to the table.  I didn't
> >>> write any code for it.  I used the wizard to create the form.
iwasinnihon - 29 Nov 2006 23:04 GMT
I figured out why I was receiving that error.  I was bringing up that
form with a button on a menu with the following command.

   DoCmd.OpenForm stDocName, , , acAdd

This brought it up in filtered mode.  I was doing that because I want
the form to come up with the controls blank.  Or in other words ready
to have the next record entered.  Is there another way to do this?

> When I try that I get the following error
>
[quoted text clipped - 60 lines]
> > >>> button it adds the information in the controls to the table.  I didn't
> > >>> write any code for it.  I used the wizard to create the form.
Steve Schapel - 30 Nov 2006 08:41 GMT
iwasinnihon,

I think there are basically two approaches you could take here.

First is, instead of your initial use of the acAdd argument, do it like
this instead...
 DoCmd.OpenForm stDocName
 DoCmd.GoToRecord , , acNewRec

Alternatively, I *think* (didn't test) you could add a line like this
ahead of the FindRecord code I suggested before...
 Me.DataEntry = False

Signature

Steve Schapel, Microsoft Access MVP

> I figured out why I was receiving that error.  I was bringing up that
> form with a button on a menu with the following command.
[quoted text clipped - 4 lines]
> the form to come up with the controls blank.  Or in other words ready
> to have the next record entered.  Is there another way to do this?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.