Topics Search

Changing Listbox "row Source" Property Using Vba

Changing Listbox "row Source" Property Using Vba
Views: 21
I have a ListBox named "lstBase" on a form named "frmBase". For reasons I cannot recall, the "Row Source" Property for the ListBox Property Sheet was populated using VBA Code with varies entries (e.g. tblAA, tblBB, etc.). I am trying to use VBA code to clear the "Row Source" Property of any entries. This is what I have tried:

Running the Macro does not generate any errors but when I open "frmBase" in Design Mode, the "Row Source" Property for "lstBase" is still populated with "tblAA, tblBB, etc."

If it makes any difference the ListBox is "Unbound" (I still do not know exactly what that means - just to show my ignorance).

How do I clear the "Row Source" Property for ListBoxes using VBA?
Sponsored Links:

More topics

 

Handling multicolumn listbox row source

Preview
I have a multicolumn listbox, and all the fields in the row source are from one table, but one of them is "assignType', a numeric field. It can be 1, 2 or 3. The thing is, I need the listbox to display text based on this numeric value, i.e. 1=assignment, 2=decision, 3=text. In other places I just put invisible textbox with control source set to assignType, wrote the text values in row source and then defined other comboboxes row source as [assignType].[column](1), but how do I solve this in listbox
 

Add items from query to listbox with vba

Preview
I know this sounds simple enough, but there is a little twist. Usually, I would just set the row source to the query and we are good to go. However, in this case, I want the user to be able to double-click to remove the selected item from the listbox. It will eventually get transferred to a different listbox.

In order to do this, the listbox row source type has to be value list, which doesn't allow me to put in an SQL statement to grab the query info.
 

Listbox multiselect status

Preview
I would like to programmatically change the ListBox.Multiselect property setting. Part of the time I want it set to "Extended" to open multiple documents. Other times I need the property set to "none".

The following line causes error that property is being used improperly:
Me.LstListBox.MultiSelect = 0 'none

I tried both setting the focus off the listbox and on the listbox and neither option seems to resolve the issue.
 

Listbox multiselect status

Preview
I would like to programmatically change the ListBox.Multiselect property setting. Part of the time I want it set to "Extended" to open multiple documents. Other times I need the property set to "none".

The following line causes error that property is being used improperly:

Me.LstListBox.MultiSelect = 0 'none

I tried both setting the focus off the listbox and on the listbox and neither option seems to resolve the issue.
 

Listbox problem

Preview
I'm working in Access 2003 from a query. I have a form with 2 comboboxes and a listbox. The comboboxes are to select Extension and Date. The listbox gives activities per extension, per day, e.g.

"Sign on", Sign off", "Idle" etc. The SQL statement I'm using for the listbox row source is as follows:

It runs this way, but using input boxes for "Extension" and "Date". I"m using those as placeholders because I want the values of te two comboboxes there instead, so users can select Extension and Date instead of inputting them.

The comboboxes are cboExtension and cboDate. What do I need to do in order to get the listbox connected to the two comboboxes?
 

Access 2000 How To's: Access Tree View and List Box Row Source

Preview
How to Load a Category Tree and Listbox RowSource Type "Field Value" Property. In this Access 2000 article, I will show you how to create a category tree and load it into a listbox. I will demonstrate the steps to create a static value list and associate it with a listbox. The algorithm can be easily ported to a treeview control or to HTML for an active server page.
 

need to use vba to change a property to table data

Preview
I am currently working a a Junior IT and am new to Access and databases in general. I have been tasked at finding a way to integrate an activex object into our database.

What I am trying to do is have it so that when we load a report the object is autmatically populated with the relevant data from a table. Unforunetly this particular control does not have a "Control Source" property, otherwise I would just modify that. I have successfully made it so that I can change the property of the object in question using vba. What I would like to know is if there is any way I can have vba insert table data, much like I would do using "control source" (if it were available
 

How Do I load a ComboBox at Runtime?

Preview
I have set the 'Row Source Type' property of a ComboBox to Table/Query. I have set the 'Row Source' property to qryFullName ( "SELECT tblAdvocates.Forename+' '+tblAdvocates.Surname AS FullName
FROM tblAdvocates;") but it loads nothing in the ComboBox ? I will check the SQL syntax, but whether it's through creating a recordset in a VBA procedure, and looping through to 'AddItems' to the list, storing the first and surname in a string, or setting a subset to set the RowSource using a query.

I wish to concatenate these 2 fields, to create a list for said ComboBox. it used to be so much easier in earlier versions of VBA!
 

How To Access From VBA A Tables Row Lookup Row Source

Preview
I created a table field with a Lookup Row Source Property Type = Value List
and a hand-coded list of values. The user can right click this field in a form and add additional values to the hand-coded Row Source (I.e. Joe, Mary, John, and then they add Mark). How can I access the Row Source in VBA because I need to use it in a drop-down UNBOUND Combo Box. I searched everywhere including the Object Browser.
 

unbound listbox. how do i make the current record selected

Preview
I have a listbox that displays the name of all the records, as I use the navigation buttons to go through different records my listbox does not update what it has selected.

My listbox is unbound and here are some things you might want to know:

Row Source:
SELECT InspectionsDI.ID, InspectionsDI.[Manhole Number] FROM [InspectionsDI Query];

Private Sub lstDI_AfterUpdate()
DoCmd.GoToRecord acDataForm, "DropInletForm", acGoTo, lstDI.ListIndex | 1 End Sub