Results 1 to 10 of 10

Thread: no current record

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Posts
    137

    Question no current record

    Hi all

    When I open the form that has information in the database , there is no problems at all, but when I open the form with empty database this is the message I get. no current record.

    Any one can help me to handl this problem please.

    I will be highly appreciated.

    Thank you

    Mohammed

  2. #2
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089

    hi

    While displaying the records use EOF and BOf properties of the recordset.

  3. #3
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    Or use this :

    VB Code:
    1. rst.MoveLast
    2.  
    3. rst.MoveFirst
    4.  
    5. If rst.Recordcount = 0 them Msgbox "No Records in table !!!"
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  4. #4
    Lively Member
    Join Date
    Jun 1999
    Posts
    120
    to use the EOF...

    VB Code:
    1. ' Before opening your form (perhaps on Form Load)...
    2. if rst.eof then
    3.  msgbox "No records found!"
    4.  ' Close the form or whatever
    5. else
    6.  'Open the form
    7. End if

  5. #5
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    Won't VB Crash with a MsgBox in the Form Load event?
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  6. #6
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808

    Re: Well

    It's always a good idea to check if the state of the recordset is opened before trying to move the cursor or do whatever with it.
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  7. #7
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    Explain "check the state", Need a Life Member...
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  8. #8
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    VB Code:
    1. If rst.State = adStateOpen Then
    2.     'Work with the recordset
    3. End If
    Emiliano F. Martín


    If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
    Encourage the person who helped you to keep doing it, and give him the points he deserves.


    MP3 Organizer: Freeware to logically organize all your MP3s.

  9. #9
    Lively Member
    Join Date
    Jun 1999
    Posts
    120
    Won't VB Crash with a MsgBox in the Form Load event?
    no...it won't crash.

  10. #10
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Well

    Sorry I was thinking of an unload event when loading the form. Sorry...
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

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