Results 1 to 4 of 4

Thread: Need Help with Finding if there is a record

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 1999
    Posts
    28

    Post

    Hi I’m trying to make a function that sees if there is a record in
    Adoski Ware The FamilyID = AdoFamily.Recordset(“FamilyID”)
    So this is what I’ve tried:

    Private Function ITASIF() As Boolean
    With AdoSki.Recordset
    .MoveFirst
    .Find " familyID = " & AdoFamily.Recordset("FamilyID"), 1
    If .EOF = True Then ITASIF = False Else ITASIF = True
    End With
    End Function

    and it Gives ITASIF = false the first time it gets run

    This is the What the data base Looks like


    +Properties
    –Family
    | |–Fields
    | |–FamilyID
    | |–Last Name
    | |–First Name
    | |–Street Address
    | |–City
    | |–State
    | |–Zip
    | |–Phone Number
    | \–E Mail
    |
    –Skiers
    |–Fields
    |–FamilyID
    |–First Name
    |–Lift
    |–Lesson
    |–Rentals
    |–Price
    \–Payed

    Thanks a lot.

    Please Help.



    [This message has been edited by Stepeh (edited 02-20-2000).]

  2. #2
    Addicted Member
    Join Date
    Jan 2000
    Location
    Sydney, Australia
    Posts
    196

    Post

    I think your problem is this: The record may not be found because you are skipping over it. E.g.

    Say the FamilyID in the adofamily recordset is 123. You do a movefirst which makes the first record the currect record (in adoski). This record may have FamilyID = 123. Then in the .Find line, the ",1" at the end specifies to skip one record before doing the search, so the first record is skipped and thus a match is not found.

    I suggest:

    1) change the ",1" to ",0" (or leave it out altogether as the default is 0) so that the first record is not skipped.

    hopefully this was your problem although it is a bit of a longshot.

  3. #3
    Addicted Member
    Join Date
    Jan 2000
    Location
    Sydney, Australia
    Posts
    196

    Post

    i just noticed one more thing, if FamilyID is a string it needs to be delimited with single quotes, so:

    .Find " familyID = " & AdoFamily.Recordset("FamilyID")

    would become

    .Find " familyID = '" & AdoFamily.Recordset("FamilyID") & "'"

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Nov 1999
    Posts
    28

    Post

    Thanks funkyd77 that fixed it


    Junior Members Rock

Posting Permissions

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



Click Here to Expand Forum to Full Width