hidden column in a combo box question

  • Thread starter Thread starter ZBC
  • Start date Start date
Z

ZBC

(Someone suggested I use this approach ... now I am ready ... but unable
to code it!)
I would like to create a combo box (cboMonth) with 2 columns on a from
with is used to print a report.
One column would contain the 'text' version of the months' ... e.g. Jan,
Feb ... for the user to select from.
The other column would contain the numeric equivalent number for the
month ...e.g. 1, 2, ...
I would like to hide the numberic column from the user on the form..
I would like to use BOTH columns:
... the 'text' column for display the 'text' version of the chosen
month on a report (as a source to a textbox on a report).
... the 'numeric' to be tied to a 'Between' in a query to designate
the ending month (the last day of the selected month) of the report.
The beginning date for the textbox will always be Jan 1 of the chosen
year (which I already have tied to another combo box (cboYear)).

I do not know how to hide one of the columns and use BOTH ?

Bob
 
Dear Bob:

Make the width of the column you wish to hide zero inches. Then you
won't be able to see it, but it will function for all purposes as
though it were there, be cause it is there, just not visible.

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
(Someone suggested I use this approach ... now I am ready ... but unable to code it!)
I would like to create a combo box (cboMonth) with 2 columns on a from with is used to print a report.
One column would contain the 'text' version of the months' ... e.g. Jan, Feb ... for the user to select from.
The other column would contain the numeric equivalent number for the month ...e.g. 1, 2, ...
I would like to hide the numberic column from the user on the form..
I would like to use BOTH columns:
... the 'text' column for display the 'text' version of the chosen month on a report (as a source to a textbox on a report).
... the 'numeric' to be tied to a 'Between' in a query to designate the ending month (the last day of the selected month) of the report.
The beginning date for the textbox will always be Jan 1 of the chosen year (which I already have tied to another combo box (cboYear)).

I do not know how to hide one of the columns and use BOTH ?

Bob





You refer to the columns in a ComboBox with the syntax...

Forms!NameOfForm!NameOfComboBox.Column(n)

....where n is the zero based ordinal position of the column you want. The fact that the column is hidden does not matter.
 
Thanks Rick,
Got part of it working ... THANKS to you guys!
Can you help me with the syntax of a where ... 'Between' criteria for
a query given:
I want to select from Jan 1, of the selected year to the last day of
the selected month
The year is: [Forms]![frmClaimSummary]![cboYear]
The numeric protion of the selected Month is:
[Forms]![frmClaimSummary]![cboMonth].Column(1)
Bob
 
Try:
Between DateSerial([Forms]![frmClaimSummary]![cboYear], [Forms]![frmClaimSummary]![cboMonth], 1) and DateSerial([Forms]![frmClaimSummary]![cboYear], [Forms]![frmClaimSummary]![cboMonth]+1, 0)


--
Duane Hookom
MS Access MVP


Thanks Rick,
Got part of it working ... THANKS to you guys!
Can you help me with the syntax of a where ... 'Between' criteria for a query given:
I want to select from Jan 1, of the selected year to the last day of the selected month
The year is: [Forms]![frmClaimSummary]![cboYear]
The numeric protion of the selected Month is: [Forms]![frmClaimSummary]![cboMonth].Column(1)
Bob

Rick Brandt wrote:

(Someone suggested I use this approach ... now I am ready ... but unable to code it!)
I would like to create a combo box (cboMonth) with 2 columns on a from with is used to print a report.
One column would contain the 'text' version of the months' ... e.g. Jan, Feb ... for the user to select from.
The other column would contain the numeric equivalent number for the month ...e.g. 1, 2, ...
I would like to hide the numberic column from the user on the form..
I would like to use BOTH columns:
... the 'text' column for display the 'text' version of the chosen month on a report (as a source to a textbox on a report).
... the 'numeric' to be tied to a 'Between' in a query to designate the ending month (the last day of the selected month) of the report.
The beginning date for the textbox will always be Jan 1 of the chosen year (which I already have tied to another combo box (cboYear)).

I do not know how to hide one of the columns and use BOTH ?

Bob





You refer to the columns in a ComboBox with the syntax...

Forms!NameOfForm!NameOfComboBox.Column(n)

...where n is the zero based ordinal position of the column you want. The fact that the column is hidden does not matter.
 
I am working in the Properties of the form ... I can find no reference
to the individual columns other than which column is the bound column.
I can change the box size, which seems to do the job.
Am I missing something?
 
I can't seem to get the [cboMonth].Column(1) into the expression correctly?
Your recommendation seems to work ... with no reference to Column(1)
.... not sure why?

Duane said:
Try:
Between DateSerial([Forms]![frmClaimSummary]![cboYear],
[Forms]![frmClaimSummary]![cboMonth], 1) and
DateSerial([Forms]![frmClaimSummary]![cboYear],
[Forms]![frmClaimSummary]![cboMonth]+1, 0)

--
Duane Hookom
MS Access MVP



"ZBC" <[email protected]
Thanks Rick,
Got part of it working ... THANKS to you guys!
Can you help me with the syntax of a where ... 'Between'
criteria for a query given:
I want to select from Jan 1, of the selected year to the last
day of the selected month
The year is: [Forms]![frmClaimSummary]![cboYear]
The numeric protion of the selected Month is:
[Forms]![frmClaimSummary]![cboMonth].Column(1)
Bob
 
I am working in the Properties of the form ... I can find no reference to the individual columns other than which column is the bound column.
I can change the box size, which seems to do the job.
Am I missing something?

In Access 97 it is the 5th property listed on the format page of the property sheet "Column Widths". For Multiple columns you separate the entries with a semi-colon.
 
ZBC said:
I can't seem to get the [cboMonth].Column(1) into the expression correctly?
Your recommendation seems to work ... with no reference to Column(1) .... not sure why?


You don't need the column reference if you are referring to the bound column. Only for the others. I'm not sure if the column reference syntax works in queries though. I often have a hidden TextBox on the form that has a ControlSource to pull in the value of the non-bound column and then have the query reference that instead.
 
Dear Bob:

Did you look at the "Column Widths" property? It is found in the
properties of the combo box or list box control. You enter the widths
from left to right, separated by semi-colons.

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
Back
Top