Arthur Fuller
fuller.artful at gmail.com
Sun Jun 17 11:45:06 CDT 2007
You can safely remove that part of the code and simplify the line right down to: rs.FindFirst "[EmpRecNum] = " & Me.Combo27 The rest is rather superfluous error checking. (If the combo opens empty and you don't make a selection then the AfterUpdate won't occur. Second, the string conversion is unnecessary because Access understands what you mean. But I don't think that's your issue. I'm sticking with References. ADO doesn't have a FindFirst method. It's just called Find. Thus, my guess is that you're using a version of Access that defaults to ADO (I think that began in 2000), but you're writing DAO syntax. Check the references and see if ActiveX Data Objects is selected. If so, then you need to set an additional reference to DAO and then move it up higher than ADO in the list, or alternatively specifically reference which one you want in the creation of the recordset. What you should be seeing in your list of references is: Microsoft ActiveX Data Objects (version) Object library Microsoft DAO 3.6 Object library If you include both, then you can specifically refer to one of them like this: Sub Test() Dim rs1 As ADODB.Recordset Dim rs2 As DAO.Recordset End Sub hth, Arthur On 6/17/07, Joe Hecht <jmhecht at earthlink.net> wrote: > > Its Joe > > The code refers to "str" > > If the record number is a long integer would that cause my issue and what > is > the easiest way to fix it? > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Joe Hecht > Sent: Saturday, June 16, 2007 8:50 PM > To: AccessD at databaseadvisors.com > Subject: [AccessD] Hi I am back and stuck > > Hi Gang, > > > > I am back and feeling silly. Can not make combo box work. > > > > I want to go to the record the combo selects > > > > > > > > Private Sub Combo27_AfterUpdate() > > ' Find the record that matches the control. > > Dim rs As Object > > > > Set rs = Me.Recordset.Clone > > rs.FindFirst "[EmpRecNum] = " & Str(Nz(Me![Combo27], 0)) > > If Not rs.EOF Then Me.Bookmark = rs.Bookmark > > End Sub > > > > The sql > > > > SELECT tblEmployee.EmpRecNum, tblEmployee.EmpNumber, tblEmployee.EmpFname, > tblEmployee.EmpLName, [emplname] & ", " & [empfname] & " " & [empNumber] > AS > Expr1 > > FROM tblEmployee > > ORDER BY tblEmployee.EmpLName; > > > > I have it so that it is showing expression one but I get > > > > Run time error 13 on the following code line: > > > > rs.FindFirst "[EmpRecNum] = " & Str(Nz(Me![Combo27], 0)) > > > > > > Please advise > > > > Thanks > > > > Joe > > -- > 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 >