Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    330
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Help with recordseet (Acc 97 sr2 on 95b)

    I am trying to create a binary string from numeric values.

    I can get the recordset to work with the first record, but how do I get it to work through the entire set?

    Set dbs = CurrentDb
    Set rst = dbs.OpenRecordset("zzTable1")
    With rst
    strTFitt = Nz(![Time1])
    strTFab = Nz(![Time2])
    If Val(strTFitt) > 0 Then strTFitt = "1" Else strTFitt = "0"
    If Val(strTFab) > 0 Then strTFab = "1" Else strTFab = "0"
    .Edit
    !state = strTFitt & strTFab
    .Update
    End With
    rst.close

    All variables are DIMmed correctly.
    "Heading for the deep end"

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Help with recordseet (Acc 97 sr2 on 95b)

    Hi Allan,
    How's the weather in 'Beautiful one day, Perfect the next' Queensland? <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    Note the additional lines in Bold

    Set dbs = CurrentDb
    Set rst = dbs.OpenRecordset("zzTable1")
    rst.MoveFirst
    Do While Not rst.Eof

    With rst
    strTFitt = Nz(![Time1])
    strTFab = Nz(![Time2])
    If Val(strTFitt) > 0 Then strTFitt = "1" Else strTFitt = "0"
    If Val(strTFab) > 0 Then strTFab = "1" Else strTFab = "0"
    .Edit
    !state = strTFitt & strTFab
    .Update
    End With
    rst.MoveNext
    Loop

    rst.close
    Set rst = Nothing
    Set dbs = Nothing


    Pat <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  3. #3
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    330
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Re: Help with recordseet (Acc 97 sr2 on 95b)

    Thanks Pat,

    I thought it might have been a do loop but was sure that I'd get something messed up somewhere.

    The weather? Cloudless and 26C already! We need a lot more rain.
    "Heading for the deep end"

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Help with recordseet (Acc 97 sr2 on 95b)

    Of course you could do this with an Update query as follows:

    UPDATE zzTable1 SET state = iif(Val(Nz([Time1]))>0,"1","0") & iif(Val(Nz([Time2]))>0,"1","0")

    I think I have got it right.

    Pat <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

Posting Permissions

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