PC Review


Reply
Thread Tools Rate Thread

Control Source / Row Source very unstable

 
 
=?Utf-8?B?TWFyYyBHZW5kcm9u?=
Guest
Posts: n/a
 
      28th Nov 2006
Hi guys,

I've read a lot of posts and they don't agree on how to reference cells in
the Control Source and the Row Source Proprieties of a ListBox or ComboBox.
I've tried the short form ("Sheet1!A1") and the long form
(Workbooks("Book1").Worksheets("Sheet1").Range("A1") or even the longer one,
with .Address at the end. NONE OF THESE ARE STABLE. They sometimes work and
sometimes, I get the "Could not set Property Value....."

Isn't there ONE RIGHT way to tell a control where to get its data? If not,
then what are the rules for using one instead of the other?

Thanks for lighting my path,
Marc

 
Reply With Quote
 
 
 
 
=?Utf-8?B?SkxHV2hpeg==?=
Guest
Posts: n/a
 
      28th Nov 2006
In the case of listbox and combobox, there is more than one way. You can
fill them with the Initialize process in code by using the AddItem method
(See VBA help). A second way, using code is:

With Worksheets(YourSheetNumber)
Set lb = .Shapes.AddFormControl(xlListBox, 100,10,100,100)
lb.ControlFormat.ListFillRange = "A1:A10"
End With

This creates the ListBox, positions it and sizes it while specifying the
range where the data resides that will be displayed in the listbox.

I have yet to find where it explains how to put a header in the box using
code.

"Marc Gendron" wrote:

> Hi guys,
>
> I've read a lot of posts and they don't agree on how to reference cells in
> the Control Source and the Row Source Proprieties of a ListBox or ComboBox.
> I've tried the short form ("Sheet1!A1") and the long form
> (Workbooks("Book1").Worksheets("Sheet1").Range("A1") or even the longer one,
> with .Address at the end. NONE OF THESE ARE STABLE. They sometimes work and
> sometimes, I get the "Could not set Property Value....."
>
> Isn't there ONE RIGHT way to tell a control where to get its data? If not,
> then what are the rules for using one instead of the other?
>
> Thanks for lighting my path,
> Marc
>

 
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
Control Source/Record Source issue Annemarie Microsoft Access Form Coding 3 29th Nov 2006 04:09 AM
Source Control - what files should/shouldn't be stored in source control MarkusR Microsoft C# .NET 22 6th Oct 2006 01:07 PM
Row source & control source on a form; PLEASE help if you can... =?Utf-8?B?YWM1MTI=?= Microsoft Access 2 6th Oct 2005 06:31 AM
Adding a web application project to source control (Visual Source Safe) ~~~ .NET Ed ~~~ Microsoft ASP .NET 1 26th Feb 2005 02:20 PM
Combo Box - Confused on Record Source vs Control Source ? ZBC Microsoft Access Forms 2 13th Jan 2004 12:37 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:52 AM.