Results 1 to 16 of 16

Thread: Status Bar.

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 1999
    Posts
    36

    Post

    Here is the code I have written in the Got_focus event of the first text box.
    Dim pnl As Panel
    With Sbr1.Panels(1).Text = "Record" & rs!Index
    .AutoSize = sbrSpring
    .Style = sbrText
    End With
    Set pnl = Sbr1.Panels.Add
    pnl.Style = sbrCaps
    pnl.AutoSize = sbrContents
    Set pnl = Sbr1.Panels.Add
    pnl.Style = sbrNum
    pnl.AutoSize = sbrContents
    Set pnl = Sbr1.Panels.Add
    pnl.Style = sbrIns
    pnl.AutoSize = sbrContents
    Set pnl = Sbr1.Panels.Add
    pnl.Style = sbrDate
    pnl.AutoSize = sbrContents
    Set pnl = Sbr1.Panels.Add
    pnl.Style = sbrTime
    pnl.AutoSize = sbrContents
    It is not working!!!
    Where is the mistake??

  2. #2

    Thread Starter
    Member
    Join Date
    Nov 1999
    Posts
    36

    Post

    rs!index is not working.Please help.
    How do I display the no. of the current record in a recorset in the status bar when the user is moving from one record to another.

  3. #3
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    You should use AbsolutePosition property of the Recordset object.

    so, when you move through the recordset you would use:


    StatusBar1.Panels(1).Text = rs.AbsolutePosition


    ------------------

    Serge

    Software Developer
    [email protected]
    [email protected]
    ICQ#: 51055819


  4. #4

    Thread Starter
    Member
    Join Date
    Nov 1999
    Posts
    36

    Post

    Thanks for your reply.It is displaying record no1 for the first time but when the user clicking the next button or previous button it is not updating the status bar.How do you do that?

  5. #5
    Hyperactive Member
    Join Date
    Jul 1999
    Location
    NY, USA
    Posts
    270

    Post

    Try something like this:

    Code:
    Private Sub Data1_Reposition()
        StatusBar1.Panels(1).Text = Data1.Recordset.AbsolutePosition
    End Sub
    ------------------
    Tom Young, 14 Year Old
    [email protected]
    ICQ: 15743470 Add Me ICQ Me
    AIM: TomY10
    PERL, JavaScript and VB Programmer

  6. #6

    Thread Starter
    Member
    Join Date
    Nov 1999
    Posts
    36

    Post

    How do I update the statusbar with the current record when the user is moving from one record to another in a recordset????
    Please help!!!!!!!!!!!!!!!!!!!!!!

  7. #7
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    You need to recall the Code Snippet Serge Posted Each Time you Move within the Recordset, ie. In your Next and Previous Command Buttons.

    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]

  8. #8

    Thread Starter
    Member
    Join Date
    Nov 1999
    Posts
    36

    Post

    In the command button
    Next
    previous
    last
    first
    I have written
    sbr_1.Panels(1).Text = "Record" & rs.AbsolutePosition & "of" & rs.RecordCount

    But still it is not updating!!!!!!!!!!!!!!!!

  9. #9

    Thread Starter
    Member
    Join Date
    Nov 1999
    Posts
    36

    Post

    Can Anybody help me??????????????

  10. #10
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Nope, you were not moving to the next record.
    Try this:

    Code:
    Private Sub cmdNext_Click()
        If rs.EOF Then Exit Sub
        rs.MoveNext
        sbr_1.Panels(1).Text = "Record" & rs.AbsolutePosition & "of" & rs.RecordCount
    End Sub
    
    Private Sub cmdPrevious_Click()
        If rs.BOF Then Exit Sub
        rs.MovePrevious
        sbr_1.Panels(1).Text = "Record" & rs.AbsolutePosition & "of" & rs.RecordCount
    End Sub
    Assuming that you have 2 command buttons cmdNext and cmdPrevious

    ------------------

    Serge

    Software Developer
    [email protected]
    [email protected]
    ICQ#: 51055819


  11. #11

    Thread Starter
    Member
    Join Date
    Nov 1999
    Posts
    36

    Post

    When the user is moving from one record to another, I want to display in the status bar which is the current record like 'Showing reocrd no 8'.How do I do that?

  12. #12
    New Member
    Join Date
    Dec 1999
    Location
    toronto,ontario, Canada
    Posts
    4

    Post

    Use the folowing approch.
    {texbox GotFocus()}--Where this is your function when you give the focus to your controls on the screen. remember that to do for each
    statusbar1.panels(1).text= rs!index

    second way is to index your controls an instgat of the recordset!index to pas the control Index to the statusbar.

    Regards Vladimir

  13. #13
    Member
    Join Date
    Nov 1999
    Posts
    63

    Post

    Anita,

    If you're using an ADO recordset or ADO data control, you will need to be sure your recordset's cursor location is set to adUseClient in order to use AbsolutePostion. BTW, the cursor location must set before the recordset is opened--it cannot be changed after it has been opened.

    Good luck, Gerald M.

  14. #14
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308

    Post

    Anita!
    Did you make it work?

  15. #15

    Thread Starter
    Member
    Join Date
    Nov 1999
    Posts
    36

    Post

    Thanks.
    The aduseclient is working fine.
    But is it true that
    If the CursorLocation property is set to adUseClient, the recordset will be accessible as read-only.
    But for me it is working, I can delete and save records???
    Please Clarify.

  16. #16
    Member
    Join Date
    Nov 1999
    Posts
    63

    Post

    Anita,

    You should be able to edit your data with a client side cursor. However, if your record source is comprised of joined tables, then there will be some problems with updating and deleting when using a client side cursor. Apparently there is not enough "key information" for the database provider to complete updates when using a client cursor. If your record source is a single table, then you should be OK.

    I wish I could speak more authoritatively on the subject or at least direct you to some documentation, but I've searched high and low for some without much success.

    Gerald M.

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