Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Find Method - Help!


Message #1 by "J. J. Campbell" <jjcampbell@w...> on Fri, 29 Dec 2000 18:19:47 -0500
I've spent hours trying to get
	rsSSN.FindFirst "Soc_Sec = '" & strSSN & "'"
to work in the below sub.  I've tried countless
variations
on the quotes.  The above line is virtually identical
to
one I found on page 257 of the WROX Beginning VB6
Database
Programming book.

All three recorsets are Access tables in my MDB.
However,
when I go into production rsSSN will be an ODBC link to
a
DataFlex table on a network drive.

Interestingly, at work today when I had an ODBC link to
the DataFlex table and I hard-code an SSN that exists
in the
table pointed to by rsSSN as follows:

	rsSSN.FindFirst "Soc_Sec = '123-45-6789'"

The sub worked.  Before leaving work, I deleted the
link and
imported the table.  Now when I try the above line I
get an
error 3251 "Operation is not supported for this type of
object"  Which is what I also now get with the & strSSN
&
version.  Bummer!

Any help will be greatly appreciated.  I'm about ready
to give
up on FindFirst and just write a do loop to cycle
through the
records until I find the SSN I'm looking for.

'------------------------------------------------------
----
Sub AddRecord(rsOld As DAO.Recordset, _
              rsNew As DAO.Recordset, _
              rsSSN As DAO.Recordset)
  'This adds a record to tblPaySummary table every time
  'a new employee is found in the tblPayroll table.  It
  'finds the employees SSN in the CAEMP table so that
it
  'can substitue their ID for their SSN in
tblPaySummary.

  Dim strSSN As String
  strSSN = rsOld!EmployeeID
  rsNew.AddNew

  rsSSN.FindFirst "Soc_Sec = '" & strSSN & "'"
  If rsSSN.NoMatch = False Then
    MsgBox ("Found " & rsSSN!SORT_NAME)
    rsNew!EmpID = rsSSN!ID
  Else
    MsgBox (strSSN & " Not Found")
    'Put something in the field until I solve the
problem!
    rsNew!EmpID = rsOld!EmpLastName & ", " &
rsOld!EmpFirstNameMI
  End If

  rsNew.Update
  bNewRec = False
End Sub
'------------------------------------------------------
-------------------------------------------------------
-----------------------------------

*****
* J. J. Campbell
* Arlington, Virginia
* MailTo:jjcampbell@w...
*****



---
You are currently subscribed to pro_vb as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-pro_vb-$subst('Recip.MemberIDChar')@p2p.wrox.com

  Return to Index