+ Reply to Thread
Results 1 to 10 of 10

VBA Code to Open Data Form

  1. #1
    Registered User
    Join Date
    10-11-2011
    Location
    London
    MS-Off Ver
    Excel 20010
    Posts
    10

    VBA Code to Open Data Form

    Hi all,

    I'm looking to make a button which will open the Data Form window, essentially to use Excel as a database. Does anyone know what the correct code is to do this?

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: VBA Code to Open Data Form

    Hi

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-11-2011
    Location
    London
    MS-Off Ver
    Excel 20010
    Posts
    10

    Re: VBA Code to Open Data Form

    Thank you for your reply. I'm still getting an error message "ShowDataForm method of Worksheet class failed"

    Here is what I'm currently using:

    ActiveSheet.ShowDataForm
    Range("A8").Select
    ActiveSheet.ShowDataForm

    I need the range to start from A8 if its possible.

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: VBA Code to Open Data Form

    For this to work, you need to have a database to set up, so you at least need column headers

  5. #5
    Registered User
    Join Date
    10-11-2011
    Location
    London
    MS-Off Ver
    Excel 20010
    Posts
    10

    Re: VBA Code to Open Data Form

    I do have headers but they on row 8, does this create the issue?

  6. #6
    Registered User
    Join Date
    10-11-2011
    Location
    London
    MS-Off Ver
    Excel 20010
    Posts
    10

    Re: VBA Code to Open Data Form

    Also, I only need the VBA code to open a 'data form' not a custom made User Form

  7. #7
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: VBA Code to Open Data Form

    If I remember aright, you have to name the range 'Database' if it does not begin within A1:B2
    Good luck.

  8. #8
    Registered User
    Join Date
    10-11-2011
    Location
    London
    MS-Off Ver
    Excel 20010
    Posts
    10

    Re: VBA Code to Open Data Form

    I can get the code to run properly until the open data form part. It will select cell A8 but then won't open the form.

  9. #9
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: VBA Code to Open Data Form

    As per my previous post, either the data must start within the range A1:B2 or you have to name the range 'Database' (formula tab, name manager). Without that the code will not work.

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

    Re: VBA Code to Open Data Form

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Hope that helps.

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

    Free DataBaseForm example

+ 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