+ Reply to Thread
Results 1 to 6 of 6

Command Buttons for Viewing Record, Next Record and Previous Record

  1. #1
    Registered User
    Join Date
    08-20-2012
    Location
    Glasgow
    MS-Off Ver
    Excel 2007
    Posts
    77

    Command Buttons for Viewing Record, Next Record and Previous Record

    Hi,

    Very new to VBA, looking to have command buttons on a UserForm that allow me to skip through to next records, previous records and viewing records.

    Have tried searching but can't find any code for this.

    Any help would be appreciated.

    Thanks

    David

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Command Buttons for Viewing Record, Next Record and Previous Record

    Hi, David,

    have you had had a look at the DataMask Excel supplies (Limitation is 32 columns of data, need to be together, no empty tows)? How are your records displayed (Listbox, ComboBox, Textboxes)? If you use the cursor in the sheet where the data is located you could use Offsst and check if EndOfFile or BeginOfFile is reached. Is that a way to start things off?

    Ciao,
    Holger

  3. #3
    Registered User
    Join Date
    08-20-2012
    Location
    Glasgow
    MS-Off Ver
    Excel 2007
    Posts
    77

    Re: Command Buttons for Viewing Record, Next Record and Previous Record

    Hi,

    I've created a Userform in VBA, i have a mixture of combo-boxes and text-boxes. The userform is set up to export the data entered in the form to the spreadsheet.

    I have added the command buttons for 'next record' and 'previous record', i want to get some code that will allow users to scroll backwards and forwards through the rows of data in the spreadsheet while in the form.

    Any guidance would be great

    David

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Command Buttons for Viewing Record, Next Record and Previous Record

    Attach an example workbook.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Registered User
    Join Date
    08-20-2012
    Location
    Glasgow
    MS-Off Ver
    Excel 2007
    Posts
    77

    Re: Command Buttons for Viewing Record, Next Record and Previous Record

    Quote Originally Posted by royUK View Post
    Attach an example workbook.
    Attached is the sample my worksheet was created from, I would like to add code to the 'next record' and 'previous record' command buttons so that users can go between records in the spreadsheet while using the form.

    Cheers

    David
    Attached Files Attached Files

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Command Buttons for Viewing Record, Next Record and Previous Record

    Hi, David,

    as you have attached a file you deserve to know from my part why I didnīt answer until now.

    To my opinion you should re-consider using just two buttons for this purpose. Access uses 5 buttons, 1 Textbox and 1 Label at the lower end of a form. If you start the form with only 2 Buttons only Next should be functional because no record is displayed and calling the previous.

    Maybe you can agree with me that it woulkd be nice to have the buttons First, Last, Next, and Previous as well as New, a Textbox where you could enter the number of the record you want to see (limited to the maximum of records in the list) and a label just giving the numbers of records.

    And maybe even you could have a look at J&R Database Form for ideas how maybe you can solve your problem.

    Ciao,
    Holger

+ 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.6.0 RC 1