+ Reply to Thread
Results 1 to 7 of 7

Thread: Userform and Nav buttons

  1. #1
    Registered User
    Join Date
    12-27-2011
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Userform and Nav buttons

    Hi everybody!!!

    Hope u are going to understand me. Coming from Croatia. I have made one userform with few butons, have searched all around WWW to find some useful tutorials on how to..? Have it all done and works perfect. Just few text boxes and few buttons. Now i go bit further and want to add nav buttons to be able to cycle thru records and update individual records. Have found one nice tutorial but part of code don t work and i can t figure it way. Maybe u guys and girls can help me to solve this problem. So far i got record shown on my form when initialize, button First and Last record working but can t get Next, Prew and Update buton to work. On end i made same sheet with same data and same form as in tutorial and u can see it on:

    http://msdn.microsoft.com/en-us/libr...ice.11%29.aspx

    Part of Next code should be all most the same as for Prew and i wrote this:

    Private Sub CommandButton3_Click()
        Dim r As Long
    
    If IsNumeric(RowNumber.Text) Then
        r = CLng(RowNumber.Text)
        
        r = r + 1
        If r > 1 And r <= LastRow Then
            RowNumber.Text = FormatNumber(r, 0)
            
        End If
        
    End If
    End Sub
    Can anybody see what s wrong. I am using Excel 2007. Thank u for time taken to read my post. Hope to get an answer.

    I wish u all marry christmas and happy new year!!!!
    Last edited by gopavic; 12-28-2011 at 02:56 PM.

  2. #2
    Valued Forum Contributor dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    New Delhi, India
    MS-Off Ver
    Excel 1997, 2000, XP, 2003, 2007, 2010
    Posts
    2,406

    Re: Userform Help

    Hi gopavic,

    I would suggest you to upload the sample workbook with user form to enable forum to help you better. Thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey
    +919810929744
    dilipandey@gmail.com

  3. #3
    Forum Guru Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,276

    Re: Userform and Nav butons

    Moderator Bump.
    Please leave a message after the beep!

  4. #4
    Registered User
    Join Date
    12-27-2011
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Userform and Nav butons

    Ok here....

    This is my simple workbook with two sheets. When u open Workbook switchboard form is displayed and forms on switchboard are working one. There is another one named "frmTest" and with that one i am coming good for. I got my cmdNav buttons now working. Maybe somebody can look on it to see if there is beter way to write the code and let me know. Next problem i got now is MsgBox i defined in Privet Sub GetData. It says Write number but on Croatian "Upisite redni broj". When i hit Add "Dodaj on Croatian" button everything is fine but when i hit Save "Spremi" work is done and msgBox comes up. That MsgBox is related to RowNumber. RowNumber is txt field between Nav butons in witch u can write record number to be displayed in form. Now how i can get rid of it on hiting Save buton?

    My Workbook:
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    12-27-2011
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Userform and Nav buttons

    I got rid of msg displaying when i hit "Spremi" button it is Save button. Now how? This way! I took RowNumber text box to side and have made it unvisible. I drow other text box and name it
    txtNavButons. Then i wrote in Private Sub GetData() foloving
    txtNavBox.Text = Cells(r, 1)
    and i delete it part with "If Then MsgBox" so my new code for part of geting data to my form looks like folowing:
    Private Sub GetData()
    
    Const LastRow = 20
    Dim r As Long
    
    If IsNumeric(RowNumber.Text) Then
        r = CLng(RowNumber.Text)
    End If
    
    If r > 7 And r <= LastRow Then
    
        txtRb.Text = Cells(r, 1)
        txtOpis.Text = Cells(r, 2)
        txtDatum.Text = Cells(r, 3)
        cboUplataIsplata.Text = Cells(r, 7)
        txtNavBox.Text = Cells(r, 1)
       If Cells(r, 7) = "Uplata" Then
            txtIznos.Text = Cells(r, 4)
       Else
            txtIznos.Text = Cells(r, 5)
        End If
            
        ElseIf r = 1 Then
        ClearData
        
    End If
    
    End Sub
    Now i cant write number of record to be displayed buut who cares i got working Nav buttons...
    I am working further... and thinking
    Last edited by gopavic; 12-29-2011 at 02:51 PM.

  6. #6
    Registered User
    Join Date
    12-27-2011
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Cool Re: Userform and Nav buttons

    Yeeeaaaa......

    I got it finally working. One small detail still left. I don t know if it is possible but i will give a try. It s about auto fill random number on the beginning
    of adding new record. Well i think i will find out soon!!!!

    Next I will translate it on english and upload it so other can play bit around it..... See u soon guys... and girls off cours...

  7. #7
    Forum Guru, retired Admin royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    25,640

    Re: Userform and Nav buttons

    Take a look at the DatabaseForm
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel Tips & Solutions, free examples and tutorials why not check out my downloads

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.2.0