Results 1 to 9 of 9
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    GetString Method (2003)

    I'm using the BindRstToSimpleUnboundFormRWInsert sub in the attached mdb to try and print the content of a filtered recordset in the immediate window and it works fine but if I uncomment the line:
    <font color=448800> Debug.Print rst1.GetString</font color=448800>
    and run the sub I get the message:
    <font color=red>Run-time error '3021': Either BOF or EOF is true, or the current record has been deleted. Requested operation requires a current record with this code.</font color=red>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: GetString Method (2003)

    I can't reproduce the error. The code runs without error with the Debug.Print line commented out.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: GetString Method (2003)

    It contains the following line (without the quotes):
    <pre>"OrderID ProductID UnitPrice Quantity Discount "
    </pre>

    Spacing is exactly as shown here.

  4. #4
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: GetString Method (2003)

    Thank you Hans,
    could you please post the content of your Immediate window you get once you've run the sub?

  5. #5
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: GetString Method (2003)

    That's what I get too with the line
    <font color=448800>Debug.Print rst1.GetString </font color=448800>
    still commented
    But if you uncomment it, shouldn't you also get the value of each field given by the GetString method?

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: GetString Method (2003)

    Oops - I'm sorry, I misread your original post. I do get the same error.
    Apparently, GetString moves the record pointer to the end of the recordset. You'll have to move it to the correct OrderID again by inserting the line

    rst1.Seek int1

    below the line with GetString.

  7. #7
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: GetString Method (2003)

    Thank you Hans,
    how come the output of
    Debug.Print rst1.GetString
    overwrites the one from
    Debug.Print str1
    in the immediate window?

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: GetString Method (2003)

    The Immediate window has a capacity of about 199 lines, operating on a First In, First Out basis. Your recordset has thousands of records, so you'll see only the last 199, and str1 has long gone.

  9. #9
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: GetString Method (2003)

    Thank you Hans

Posting Permissions

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