Results 1 to 6 of 6
  1. #1
    Seito is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    5

    Click to call and TempVariable

    Hy.



    I have this database with couple of forms. Now I would like to add some nice functions to it.

    First, we have Click-2-Call system in our office. So I would like to program button to push this code to our servers:

    Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
    URL = "http://192.168.2.37:9191/?user=pothos&From=#######&To=########"
    objHTTP.Open "POST", URL, False
    objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
    objHTTP.send ("")


    Code is fine and it works. Only problem is that it only works if I manually change both - value for From=####### AND value for To=######## in to numbers I would like to dial (FROM is my phone and TO is phone number I wish to call).

    And now I would like it to change automatically with every record in form.

    change FROM
    I use log in form where user chooses which work station is he/she working on. And then this value is saved as TempVariable. So for this to work I think I should write Dlookup function to look up which phone corresponds to work station ID that is stored in TempVariable. And then referenced it in upper code after From=

    But I don't know how to do that? Any help appreciated !

    change TO
    Phone number for customer I wish to call is in SAME subform as button which calls for this code (if that is perhaps important). Structure goes like this:
    Main Form - FORM1
    Tab - TAB1 (Many tabs because it's tabbed main form. If that is somehow important for referencing)
    Subform - SUBFORM1
    Field - FIELD1 (where number I wish to put instead of ###### is stored)
    Button - BUTTON1 (in same subform as FIELD1 and I wish to put this code in OnClick event)

    I tried with Me.FIELD1 and Me!FIELD1 and many other try and error options ! And all were error. So, please, can you help me?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I'm not clear on your setup, but generally you would concatenate a variable or form reference into the string:

    URL = "http://192.168.2.37:9191/?user=pothos&From=" & VariableName & "&To=" & Forms!FormName.ControlName
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Seito is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    5
    THANK YOU pbaldy! That saved most of mine problems. One last NOOB question:

    At the moment I have:

    DLookup("PHONE_NUMBER", "tblWORK_STATIONS", _
    "[ID_WORK_STATION] = TempVars!TempWorkStation")

    But nothing is happening. And I want to get appropriate phone number from table WORK_STATIONS according to ID of work station that was saved as Temporary variable when user logged in.

    how do I reference Tempvar as a criteria in Dlookup function?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I don't use TempVars, but try concatenating it like a form reference:

    DLookup Usage Samples
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Seito is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    5
    Thank you. I found the problem and it was not in code. Server only wants lats 4 digits and not whole number, and after I corrected it in table everything works perfectly.

    Thank you for your time!

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Glad you got it sorted out.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. ODBC--call failed
    By TCB in forum Access
    Replies: 4
    Last Post: 04-28-2011, 08:23 AM
  2. Help Writing VBA and call to query
    By brianb in forum Programming
    Replies: 7
    Last Post: 03-09-2011, 09:42 AM
  3. invalid procedure call
    By johnmerlino in forum Access
    Replies: 5
    Last Post: 12-13-2010, 10:12 AM
  4. Help in service call Database
    By Nokia N93 in forum Access
    Replies: 12
    Last Post: 11-19-2010, 02:10 PM
  5. how to call a sub procedure?
    By dollygg in forum Access
    Replies: 1
    Last Post: 08-18-2009, 05:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums