+ Reply to Thread
Results 1 to 11 of 11

Using ComboBox to call another function

  1. #1
    Forum Contributor
    Join Date
    06-06-2008
    Location
    Manchester
    MS-Off Ver
    MS Office 2003
    Posts
    161

    Using ComboBox to call another function

    How is it possible to take the choice from the Combo Box and send that into a Stored Procedure statement in Excel VBA

    I have 3 Combo Boxes, Months, Years, Date.

    I'm trying to fillout these into this statement to run my Stored Procedure...

    Please Login or Register  to view this content.
    This is my full code that brings back the results

    Please Login or Register  to view this content.
    How is it possible to do this?

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437
    Something like this, change the combo names to suit.
    Also assume the Values are in the correct format for simple substitution.

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    06-06-2008
    Location
    Manchester
    MS-Off Ver
    MS Office 2003
    Posts
    161
    Thanks for that, I've tried it and I get a Compile Error: Variable not Defined, what do I need to delcare the ComboBox as?

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437
    So what does your code look like?

  5. #5
    Forum Contributor
    Join Date
    06-06-2008
    Location
    Manchester
    MS-Off Ver
    MS Office 2003
    Posts
    161
    My code

    Please Login or Register  to view this content.

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437
    I assume you have the combo boxes on a userform and the code is within that userforms code module, yes?

  7. #7
    Forum Contributor
    Join Date
    06-06-2008
    Location
    Manchester
    MS-Off Ver
    MS Office 2003
    Posts
    161
    No my Combo's are just on the worksheet, with a Range of Data to populate them linked to them...

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437
    Is the code in the worksheet object or a standard code module?

    If in a standard code module you will need to create a reference to the controls on the sheet.

  9. #9
    Forum Contributor
    Join Date
    06-06-2008
    Location
    Manchester
    MS-Off Ver
    MS Office 2003
    Posts
    161
    I used the ListFillRange in the Combo Properties

    How do you mean create reference controls?

  10. #10
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437
    You said the compiler was complaining about the references to the comboboxes.

    Currently the compiler does not know where or what cboMonths is.

    You need to create a reference to it.

    Please Login or Register  to view this content.
    Changing Sheet1 to appropriate name.

  11. #11
    Forum Contributor
    Join Date
    06-06-2008
    Location
    Manchester
    MS-Off Ver
    MS Office 2003
    Posts
    161
    Excellent that works... Thanks :-)

+ 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. Send excel cells automatically via Lotus Notes 7
    By jiminic in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-05-2008, 01:35 AM
  2. Combobox, projector issue.
    By Alvein in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-25-2008, 08:35 AM
  3. Sorting Macro
    By Dohko in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 04-16-2007, 08:04 AM
  4. Hyper link to call function
    By jonn in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-08-2007, 02:58 PM
  5. Finding next empty row in another worksheet
    By spyrule in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-13-2006, 10:56 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