Pass Variable to Access Textbox via excel dbl click event

  • I am probably dreaming but thought I would ask to see if it's possible.

    The database contains all the reports, data etc. for the excel sheet. What I am looking to see if it can happen, is in Column B of my tracking sheet is a RCN number.. it is basically the report number of the data in the database pertaining to that report.. so kinda the key if you will.

    In the database we take this number type it into the text box that is named RCN and hit enter, it opens a word document with the report...

    What I am wondering.. is there a way to double click the RCN number in Column B and it autofill the RCN text box of the database.

    The database will be open....

    Ok.. am I dreaming or is this possible? I know I can get a number *from* access and populate a excel field, I am just not sure about populating the textbox via excell

    Excel Gods... thank you...

    Thanks in advance.

  • Re: Pass Variable to Access Textbox via excel dbl click event


    Sounds to me like an unnecessary step. How does the form create the Word doc? If it's code, it may be possible to simply call that code directly and pass the number to it rather than using the form at all.

    Rory
    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

  • Re: Pass Variable to Access Textbox via excel dbl click event


    Just to add, it is certainly possible to populate a form loaded in Access from Excel, just seems like a long winded way of doing it!
    For example:

    Code
    Dim objAcc As Object
       Set objAcc = GetObject(, "Access.Application")
       objAcc.Screen.ActiveForm.Controls("text box name").Value = Range("A1").Value

    Rory
    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

  • Re: Pass Variable to Access Textbox via excel dbl click event


    Hi Rory,

    Thanks for the reply... the report is ran by having the report number typed into the text box, then when you would hit enter, it runs the Macro "ExportToReport"

    That Macro is:


    Code
    ACTION                          ARGUMENTS
    -------                           ------------
    Echo                               No,
    RunSavedImportExport       Export-vRCN REPORT



    The Export-vRCN REPORT is the name of the saved steps to open the report (I am an excel guy, so I will take their word for it)

    So.. recap...

    I type in the report number from my tracking sheet to pull the report.. 5851 ... I type that in the textbox on the form and hit enter, it runs the report and opens a .rtf word file with the report.. I save the word document and then.. next number...

    so what I am trying to do is pass the RCN # ie 5851 to the form, and then either I hit enter, or even better, it runs the report.. I would like to "pass it" via double clicking in the RCN # in Column B to pass or run the report.. if it's possible.

    Thanks again.. I will tinker with your code..

    Joe

  • Re: Pass Variable to Access Textbox via excel dbl click event


    Rory,

    Thanks that works perfectly.. now I am off to find out how to run a macro in access from the same double click function... Here is the code I used, it pulls from the cell I am double clicking in, incase anyone is looking for this type of code...

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!