+ Reply to Thread
Results 1 to 18 of 18

Userform to get data from database

  1. #1
    Forum Contributor
    Join Date
    11-29-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    106

    Userform to get data from database

    Hi all,

    I need to make one userform that can take data from a specific range
    of date from a specific range of data.
    Attached is the sample worksheet i'm working on.
    In Sheet1 is the userform & Sheet2 is the database.

    (Note : Database information is a daily update basis)

    Thank you in advance
    Attached Files Attached Files

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Userform to get data from database

    try this,
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    11-29-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    106

    Re: Userform to get data from database

    Dear davesexcel,

    I'm still new with this vba stuff. I need to put this code in a module
    then assigned it to a button, right?
    Can I directly copy this code to my sample file?
    or do I need to edit something..

    FYI, I received error dialog box that "Runtime error 1004: Unable to get average property
    of the worksheet function class"

    Thank you

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Userform to get data from database

    Check out the attached.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    09-18-2014
    Location
    Pakistan
    MS-Off Ver
    2013, 2016
    Posts
    283

    Re: Userform to get data from database

    Check the davesexcel's attached file.
    And you can copy the code directly to your worksheet.

  6. #6
    Forum Contributor
    Join Date
    11-29-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    106

    Re: Userform to get data from database

    Dear davesexcel,

    I have tried the file on my PC, but received Runtime error 1004 again,
    with "No cells were found" dialog box.
    Is there any setting that I need to change on my PC?

    Thank you

  7. #7
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Userform to get data from database

    Is this from the sample I attached?

  8. #8
    Forum Contributor
    Join Date
    11-29-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    106

    Re: Userform to get data from database

    yes sir

    below is the screen captured

    Capture.PNG
    Last edited by namialus; 02-22-2015 at 11:58 AM.

  9. #9
    Forum Contributor
    Join Date
    11-29-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    106

    Re: Userform to get data from database

    Dear davesexcel,

    I have tried the file on my MS Office 2007 & 2010, but same error appeared.
    Is it because of the AutoFilter?
    Please guide me.

    Thank you

  10. #10
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Userform to get data from database

    Maybe an if error statement is required.

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    11-29-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    106

    Re: Userform to get data from database

    Dear davesexcel,

    I'm really appreciate your reply. However I still can't make
    the file running smooth.
    FYI, I have changed the macro code accordingly (with the if statement).
    But it does not copy any data, and it copy the range header only (refer below image)

    Capture.PNG

    Then, I tried to change the source data from list menu, but received "No Data to copy" error
    (refer below image)
    Capture2.PNG

    Hope you can assist me on this..

    Thank you in advance

  12. #12
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Userform to get data from database

    I don't know Try this new attachment, if it doesn't work as soon as you use it, a new approach will have to be used.
    Attached Files Attached Files

  13. #13
    Forum Contributor
    Join Date
    11-29-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    106

    Re: Userform to get data from database

    Dear davesexcel,

    Thank you for your quick reply and guidance.
    I have tried the file & still received error :
    Capture.PNG

    Not sure why it's not working.
    Would much appreciate if you can help & assist me

    Thank you

  14. #14
    Forum Contributor
    Join Date
    11-29-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    106

    Re: Userform to get data from database

    I upload again my original file with some explaination about what is needed

    Thank you
    Attached Files Attached Files

  15. #15
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Userform to get data from database

    Here is your worksheet in action

    https://www.youtube.com/watch?v=baOO...ature=youtu.be

    Someone else is going to see if it is an XL'07 issue.

  16. #16
    Forum Contributor
    Join Date
    11-29-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    106

    Re: Userform to get data from database

    Hi davesexcel,
    What you've done does meet my request.
    If its XL 07 issue, can it be resolved?
    Or do i need to change any setting ?

    Thank you


    Sent from my iPhone using Tapatalk

  17. #17
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Userform to get data from database

    Try changing this line:
    Please Login or Register  to view this content.
    to this:
    Please Login or Register  to view this content.
    Remember what the dormouse said
    Feed your head

  18. #18
    Forum Contributor
    Join Date
    11-29-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    106

    Re: Userform to get data from database

    Hi romperstomper,

    The code works great !
    A very much thank you to you & davesexcel.
    You guys are really helpful..
    Thank you again

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Send data of userform to a database
    By MariaPap in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-16-2013, 02:44 PM
  2. Creating A userform to enter data into a database
    By john dalton in forum Excel General
    Replies: 8
    Last Post: 01-03-2011, 06:25 AM
  3. Multiple Users of VBA Userform, all data saved to one database
    By oliver_l in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-22-2010, 01:41 AM
  4. Database userform search data, go to row
    By dmanatee in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-12-2010, 09:06 AM
  5. Deleting data in userform and database
    By Jennifer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-13-2005, 09:05 AM

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