Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Forms, Bound Columns etc

Hi All,

Hope this makes sense.

I have a combobox on a form (say called MyCBX) which when the form is
initialised is populated with a named range (say MyRange) consisting of 2
columns. The relevant properties of the combo box a

BoundColumn 2
ColumnCount 2
Width 0pt;180pt

In the named range column 1 contains a dbCode and column 2 contains the
description.

So on initialising the form MyCBX.RowSource = "MyRange"
On entering data ActiveCell.Offset(1,0).Value =
MyCBX.Column(0)

This works fine and enters the code in a database style spreadsheet. The
problem arises when the same form is used to edit/amend a record that has
already been written.

So on initialising the form MyCBX.RowSource = "MyRange"
MyCBX.Value =
"ActiveCell.Offset(1,0).Value

It is this last line that causes the problem because it is retrieving the
dbCode written by the spreadsheet rather than the Description. The
description is not written to the database spreadsheet.

Is there a way that l can force the MyCBX.Value to the Description?

TIA

Regards

Michael Beckinsale


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Forms, Bound Columns etc

Hi All,

Just to let you know that the problem is sorted in case anybody is working
on it.

Solution was as follows:

this code placed in the form_initialize event

MyCBX.Value = Application.WorksheetFunction.VLookup(ActiveCell.O ffset(0,
1).Value, Range("MyRange"), 2, False)

where "MyRange" is the named range used to populate the row source

Regards

Michael Beckinsale

"Michael Beckinsale" wrote in message
...
Hi All,

Hope this makes sense.

I have a combobox on a form (say called MyCBX) which when the form is
initialised is populated with a named range (say MyRange) consisting of 2
columns. The relevant properties of the combo box a

BoundColumn 2
ColumnCount 2
Width 0pt;180pt

In the named range column 1 contains a dbCode and column 2 contains the
description.

So on initialising the form MyCBX.RowSource = "MyRange"
On entering data ActiveCell.Offset(1,0).Value =
MyCBX.Column(0)

This works fine and enters the code in a database style spreadsheet. The
problem arises when the same form is used to edit/amend a record that has
already been written.

So on initialising the form MyCBX.RowSource = "MyRange"
MyCBX.Value =
"ActiveCell.Offset(1,0).Value

It is this last line that causes the problem because it is retrieving the
dbCode written by the spreadsheet rather than the Description. The
description is not written to the database spreadsheet.

Is there a way that l can force the MyCBX.Value to the Description?

TIA

Regards

Michael Beckinsale



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
What does "Workbook has no bound sheets" mean? robinsgate Excel Discussion (Misc queries) 1 March 15th 05 11:02 PM
Data bound VBA forms Andy Excel Programming 2 September 14th 04 04:49 PM
bound columns - listbox question Amy Excel Programming 2 June 24th 04 02:11 PM
Listbox with Bound Columns Vijay Bhatawdekar Excel Programming 0 February 11th 04 07:47 AM
Multi-column ListBox. Multiple bound columns??? Joe Mathis Excel Programming 5 December 10th 03 01:32 AM


All times are GMT +1. The time now is 02:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"