John W. Colby
jwcolby at colbyconsulting.com
Thu Mar 4 08:04:00 CST 2004
Is this combo bound to a nontext field? If so then the first column (column(0) must be a numeric value. Furthermore the syntax Me![cboNCSANo] MAY be correct but I don't think so. It should be me!cboNCNSANo The [] generally denotes a field and usually tells the compiler to try and interpret whatever is between the [] as a field name. In any event, whether or not the [] is legal, me!CtlName is definitely valid. Further if I'm not mistaken (assuming that column(0) of the combo is not bound to a numeric field which by itself would be causing your problems) The default property of a combo is column(0) which would contain the value "*" so the case should be if me!CboNCSANo = "*" then else endif You can make it unambiguous in any case by specifying the column you intend to evaluate if me!CboNCSANo.column(0) = "*" then else endif or if me!CboNCSANo.column(1) = "All" then else endif FURTHER... the SQL statement has to use a LIKE instead of an = DoCmd.ApplyFilter , "[NCSAID] LIKE " & str(Me![cboNCSANo]) The reason is that LIKE evaluates an * as a wildcard whereas = evaluates the * literally, i.e. it would match any records with an asterisk in the field. I don't think any of this has anything to do with your type mismatch though John W. Colby www.ColbyConsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Hollis,Virginia Sent: Thursday, March 04, 2004 8:29 AM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] Add All to List Still struggling... On the recordsource for the combo box I put: SELECT tbl_NCSA.NCSAID, tbl_NCSA.NCSANo FROM tbl_NCSA; UNION SELECT "*", "All" FROM tbl_NCSA; This gets me the word ALL in the list. Then on the AfterUpdate of cboNCSANo, I put (this gives me a type mismatch when I select All): If Me![cboNCSANo] = "All" Then DoCmd.ShowAllRecords Else DoCmd.ApplyFilter , "[NCSAID] = " & str(Me![cboNCSANo]) End If Va. -----Original Message----- From: William Hindman [mailto:wdhindman at bellsouth.net] Sent: Wednesday, March 03, 2004 4:07 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Add All to List ...the easiest way is to "if" the combo's after update event :) After Update Event cboCustomer If Me![cboCustomer] = "<All>" Then DoCmd ShowAllRecords Else DoCmd ApplyFilter , "[State] = Forms![cboCustomer]![cboCustomer]" End If William Hindman "My idea of an agreeable person is a person who agrees with me." Disraeli ----- Original Message ----- From: "Hollis,Virginia" <HollisVJ at pgdp.usec.com> To: "'Access Developers discussion and problem solving'" <accessd at databaseadvisors.com> Sent: Wednesday, March 03, 2004 4:29 PM Subject: RE: [AccessD] Add All to List > I don't know what I am doing wrong.... The all shows at the top of the list, > but All the records do not show on the subform. The combobox is still > showing the first record when it opens and the subform is filtered for that > record. > > What makes the All part of "ALL" in the combo box work? > > Virginia > > -----Original Message----- > From: William Hindman [mailto:wdhindman at bellsouth.net] > Sent: Wednesday, March 03, 2004 8:09 AM > To: Access Developers discussion and problem solving > Subject: Re: [AccessD] Add All to List > > > Virginia > > ...use a UNION SELECT in the combo record source to add an ALL. > > ...example: > > SELECT DISTINCTROW Customers.Company, Customers.[Customer Number] FROM > Customers UNION SELECT "<ALL>","" FROM Customers ORDER BY Customers.Company; > > William Hindman "My idea of an agreeable person is a person who agrees with > me." Disraeli > > ----- Original Message ----- > From: "Hollis,Virginia" <HollisVJ at pgdp.usec.com> > To: <accessd at databaseadvisors.com> > Sent: Wednesday, March 03, 2004 8:45 AM > Subject: [AccessD] Add All to List > > > > How do you add All to List? This form contains 2 combo boxes on a main > form. > > Selecting data shows data on a subform for the related combo box choices. > > > > I need to either have an All in the combo boxes or when the form opens, I > > would like them to be blank. > > > > I tried this code in the On Open of the main form, but it still opens to > > the first record with entries in both combo boxes. > > > > With Me > > .cboNCSANo = "" > > .cboProcedure = "" > > End With > > > > Virginia > > -- > > _______________________________________________ > > 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 > -- > _______________________________________________ > 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 -- _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com