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 / June 2007

Tip: Looking for answers? Try searching our database.

how to clear Combo box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Karthikeyan Periasamy - 20 Jun 2007 14:34 GMT
How can I clear a combo box. ie., I want to reload the combo. Like in VB
comboName.Clear is there but in MS Access how to clear the values and Reload
the value. Actually I lad the combo like this ...
rec.open "SELECT EMP_ID from EMP_mast  ", adoopenforwardonly,adlockreadonly
while rec.eof  = false
     mycombo.additem rec!Emp_ID
      rec.movenext
wend

Thanks in Advance.....
Carl Rapson - 20 Jun 2007 16:03 GMT
> How can I clear a combo box. ie., I want to reload the combo. Like in VB
> comboName.Clear is there but in MS Access how to clear the values and
[quoted text clipped - 8 lines]
>
> Thanks in Advance.....

You should be able to clear a combo box by clearing its Row Source:

   mycombo.RowSource = ""

As a note, however, you could set the Row Source of the combo box directly
to the SQL statement:

    mycombo.RowSource = "SELECT EMP_ID from EMP_mast"

Just change the RowSourceType to Table/Query first.

Carl Rapson
Karthikeyan Periasamy - 21 Jun 2007 06:07 GMT
Thank you verymuch for ur reply.... Its really usefull for me.
But In some case
Form!Myform!Mycombo.requery
is not load the combo with the Recently inserted value. ie., its not
refreshing again.
Can u help be for above problem?

> > How can I clear a combo box. ie., I want to reload the combo. Like in VB
> > comboName.Clear is there but in MS Access how to clear the values and
[quoted text clipped - 21 lines]
>
> Carl Rapson
Carl Rapson - 21 Jun 2007 15:54 GMT
How are you inserting the value? It may be that you are requerying your
combo box before the Insert is written to the database.

Carl Rapson

> Thank you verymuch for ur reply.... Its really usefull for me.
> But In some case
[quoted text clipped - 30 lines]
>>
>> Carl Rapson
Mr. B - 20 Jun 2007 16:11 GMT
> How can I clear a combo box. ie., I want to reload the combo. Like in VB
> comboName.Clear is there but in MS Access how to clear the values and Reload
[quoted text clipped - 6 lines]
>
> Thanks in Advance.....

Actully in Access you do not have to use the AddItem method.  You
simply set the Row Source to an sql statement or query that returns
the recordset you want.  You can have multiple colums of information
in any combo box but only show one column in the box.  You can bind
any column but show multiple columns of info when the list is droped
down.

When you want to refresh the list (say after adding a new record to
the table(s) from which the combo box gets its data, just use:

me.NameOfControl.Requery

If you need to actually change the source (completey different sql
statement or query) just redefine the row source and requery the combo
box.

with me.NameOfControl
    .rowsource = strSql '(variable that holds the sql string or us
the name of a query)
    .requery
end with

HTH

Mr B
Karthikeyan Periasamy - 21 Jun 2007 06:12 GMT
Thank u very much.. for ur reply...,
I changed that combo load from Additem to  Rowsource. Its working fine.
If i want to refresh the combo with recently inserted value. I wrote the
code like this. Form!Myform!Mycombo.Requery.  some time Its not  refreshing
the combo....?
can u please help me?....  

> > How can I clear a combo box. ie., I want to reload the combo. Like in VB
> > comboName.Clear is there but in MS Access how to clear the values and Reload
[quoted text clipped - 32 lines]
>
> Mr B
 
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.