Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2002
    Location
    Washington D.C.
    Posts
    164

    Unanswered: Problem with finding data in a Recordset

    Hi,
    I have a backend SQL Server and an adp access front end.
    On my contacts form I have a list box which lists all the available addresses for a contact and its bound column is the address ID.
    If the user wants to view the address I have a button which the user can click to see the Address form, here is the code that I use:

    If IsNull(Me!CompAdrsPersonList) = True Then
    Dim strMsg


    strMsg = "You have not selected an address to view/edit." & Chr(13)
    strMsg = strMsg & "Please select an address from the Company Address list."
    MsgBox strMsg, vbCritical, "Select a Company Address"

    Exit Sub
    End If



    If CurrentProject.AllForms("frmCompanyAdrsForContact" ).IsLoaded = False Then
    DoCmd.OpenForm "frmCompanyAdrsForContact"

    End If



    Set RS = Forms!frmCompanyAdrsForContact.Recordset.Clone
    RS.Find "[CompAdrsID]=" & Me!CompAdrsPersonList
    If Not RS.EOF Then Forms!frmCompanyAdrsForContact.Bookmark = RS.Bookmark

    End Sub


    ======================================
    My problem is that for some records the Recordset returns EOF and I can't understand why?? because I'm sure that the address id exists in the table.

    I thought that the ID is not being passed in some cases so I created a message box msgbox Me!CompAdrsPersonList, and i saw that all the values are passed but the wierd thing was that when I put a message box, for the same record that would return EOF, it wouldn't return EOF after I hit the OK button of the message!!!
    In general for the same records that retunr EOF, when I open the new form and navigate it woudln't return EOF?!

    Can anyone help me?
    Last edited by Sia; 04-22-03 at 16:20.

  2. #2
    Join Date
    Aug 2002
    Posts
    31
    Try putting a RS.MoveFirst in there....

    Have fun,
    Maia

  3. #3
    Join Date
    Dec 2002
    Location
    Washington D.C.
    Posts
    164
    I already tried that. it doesn't work.
    It seems that the recordset returns EOF amd I can't understand why.
    If I open the form and then run the code twice it works fine?
    I can't understand why!







    Originally posted by Maia
    Try putting a RS.MoveFirst in there....

    Have fun,
    Maia

Posting Permissions

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