+ Reply to Thread
Results 1 to 5 of 5

Excel VBA - Return Employee Records From Access Based on Selected Department

  1. #1
    Registered User
    Join Date
    07-30-2013
    Location
    Maryland
    MS-Off Ver
    365
    Posts
    11

    Excel VBA - Return Employee Records From Access Based on Selected Department

    Hello,

    I'm pretty new to Excel VBA and using Access at all. I realize that it is not recommended to use Excel as a front end for Access, but due to many constraints, that is what I have been tasked to do. I have been able to find enough information to write a macro to return Employee Information for a specified department. What I would like to do now, however, is see if it is possible to refer to a specific cell on my spreadsheet, for which I will have a drop down, and return the employees from that department.

    I have tried defining a string for the department and assigning it the value in the drop down box (cell P2), then attempting to have the macro return values where the department is equal to that string, but I keep getting errors. Here's one of the many iterations of lines that I experimented with adding and did not have any luck:

    Please Login or Register  to view this content.
    I'm not sure if any of this is possible and I appreciate any help. Here's the code which worked to return all employee data from the sales department:

    Please Login or Register  to view this content.
    Last edited by djbehar; 12-18-2019 at 05:10 PM.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,462

    Re: Excel VBA - Return Employee Records From Access Based on Selected Department

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    I did it for you this time. Please read forum rules. Thanks

  3. #3
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,462

    Re: Excel VBA - Return Employee Records From Access Based on Selected Department

    BTW Your profile indicates you are using XL 2003. is this still the case? Perhaps adapt your profile to your actual version if need be? Thx

  4. #4
    Registered User
    Join Date
    07-30-2013
    Location
    Maryland
    MS-Off Ver
    365
    Posts
    11

    Re: Excel VBA - Return Employee Records From Access Based on Selected Department

    Thanks for your help on that. I had created this account long ago and had not since updated it to my current version of 2013. Also, thanks for your help with the tags. I'll get that right next time.

  5. #5
    Registered User
    Join Date
    07-30-2013
    Location
    Maryland
    MS-Off Ver
    365
    Posts
    11

    Re: Excel VBA - Return Employee Records From Access Based on Selected Department

    Never mind, I figured it out. I had everything jumbled. In case any one is interested, I added the following lines where appropriate:

    Please Login or Register  to view this content.

+ 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. Replies: 1
    Last Post: 11-18-2019, 10:57 AM
  2. convert multiple employee records to one record per employee
    By jmccullough in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-27-2016, 10:39 AM
  3. Replies: 2
    Last Post: 12-18-2015, 02:42 PM
  4. Query Access database and return all records to Excel
    By bfs3 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-18-2014, 11:01 PM
  5. Array to bring employee by department
    By jripchik in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-21-2012, 01:09 PM
  6. Replies: 8
    Last Post: 02-28-2012, 01:51 AM
  7. Replies: 1
    Last Post: 05-25-2011, 02:37 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