John Clark
John.Clark at niagaracounty.com
Mon Feb 10 12:52:00 CST 2003
I think you may have just fixed my problems Arthur. Thank you! I tried this, and it does appear to work. Now I have to put the data into the table...it doesn't seem to work with cboResults' Control Source set to the field. I should, should it not? And...this you will think me stupid for...how do I set the column widths? I want the first to show, but not the next two, although I need their data. The combo's Row Source is set to, "SELECT DISTINCTROW [qryResultsCBO].[RESULTS], [qryResultsCBO].[kID], [qryResultsCBO].[txtResult] FROM [qryResultsCBO];" The whole point of this was for "looks!" In their current program, they have 12 check boxes, in 3 sections. It can only be one of these, so I figured, "why waste all that space, and reserver 12 fields?" Also, their choices have changed since they got the old program, but since it was all "hard-coded" the program still listed the old choices. I want it to be dynamic for them. >>> artful at rogers.com 02/10/03 12:19PM >>> It seems that the line between three questions has blurred. You very seldom want to test the length of a combo-box column. In fact, I can't think of one instance in which I wanted this value, since I could get this value not from the data but from the ColumnWidths property. Perhaps you're testing for the absence of data, in which case you're testing the wrong property. A combo-box has a zero-based array of columns. In the typical instance, the PK is in column 0 with a width of 0, so it's hidden. Some text field such as companyName is in column 1, with a width > 0 so it's visible. Other columns may appear or not. (I often add several invisible columns containing information I will need elsewhere in the form, for example the concert date or the ticket price or the current number of tickets available.) Given this: Me.cboName.Column(0) returns the PK in question. Me.cboName.Column(1) returns the carbon-unit-friendly text. Me.cboName.Column(n) returns one of the invisible columns mentioned above. Before doing anything else, test that the combo is not null. If Not IsNull(me.cboName) Then doStuff End If It could be that column(n) in the selected row is NULL, which fact may be important in your app. For example, if DepartmentID is NULL, enable the DepartmentID combo-box, else disable it. Me.cboDepartmentID.Enabled = IsNull(me.cboDepartmentID) Hth, Arthur -----Original Message----- From: accessd-admin at databaseadvisors.com [mailto:accessd-admin at databaseadvisors.com] On Behalf Of John Clark Sent: February 10, 2003 11:20 AM To: accessd at databaseadvisors.com Subject: [AccessD] length of combo box choice (shorter version) I have a combo box, in an A97 form, w/three columns. I want to test the length of one of these columns for some code that I have. How do I refer to a specific column in the syntax for the Len function? I used, "If Len(frmFEDSMain!cboResults.ItemsSelected) > 10 Then" and "Len([Forms]![frmFEDSMain]![cboResults].[Column](0))" but these do not work. I had used the first syntax origianlly, and it worked. But, I had forgotten to fill in the control source (I know...stupid), and it quit working, when I filled this in. I also tried a roundabout approach, by putting "chkstring = [Forms]![frmFEDSMain]![cboResults].[Column](0)" and sticking this variable into the Len function, but this returns 42 (or whatever the length of the actual string is). Any ideas? Thanks! John W Clark _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com