Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2002
    Posts
    9

    Unanswered: Recordset Update Problem

    Hi,

    I have been trying for the last two days to get this piece of code working:

    However I am having no luck.

    I need to use the names in table "one" With the first name and go and see if exists in table "two".

    If there is a match(s) It then ticks a box for every match found.

    Once it has finished searching for the first name in table one, I then need it to move onto the second name in table one and search table two again etc etc.

    Public Sub GetLName()
    Dim dbMonthlyReports2000 As DAO.Database
    Dim rst As DAO.Recordset
    Dim strCritera, strCritera2 As String
    Dim rst, rst1
    Set dbMonthlyReports2000 = CurrentDb
    Set rst = dbMonthlyReports2000.OpenRecordset("CB_March_2004" , dbOpenDynaset)
    Set rst1 = dbMonthlyReports2000.OpenRecordset("CBSearch", dbOpenDynaset)

    Do Until rst.EOF
    strCritera = rst!Surname
    rst1.FindFirst rst1!Customer = strCritera
    Do Until rst1.NoMatch
    If rst1!customer = strCritera Then
    rst1.Edit
    rst1!Buy = True
    rst1.Update
    Else
    End If
    rst1.FindNext rst1.customer = strCritera
    Loop
    rst.MoveNext
    Loop
    rst.Close
    rst1.Close
    dbMonthlyReports2000.Close

    End Sub

    Thanks in advance

    Darrell......

  2. #2
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346
    How about doing a join query and then using the results of that query to check the boxes you need?

    i.e.

    SELECT Name FROM Table1 JOIN Table2 ON Table1.FirstName=Table2.FirstName

    (Fix the syntax)
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •