Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2010
    Location
    UK
    Posts
    160

    Unanswered: Popup message requesting value - sql issues

    Hi all,

    I'm having trouble running this SQL. A message box pops up asking for the value of the string gbl_CommandPointer

    Any ideas what i'm doing wrong?

    DoCmd****nSQL "UPDATE tbl_PSA_Orders SET tbl_PSA_Orders.Sub_Category = (gbl_CommandPointer) WHERE (((tbl_PSA_Orders.Sub_Category) = (gbl_CommandPointer)) And ((tbl_PSA_Orders.fkeyPSA_ID) = [Forms]![Main_Sub_Items]![txtbox_SubItems_Ref_ID]))"

    thanks
    marcus

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    If, as I believe, gbl_CommandPointer is a global variable, create a public function that returns the value and use the function in the query:
    Code:
    Public Function GetCommandPointer() As String
        GetCommandPointer = gbl_CommandPointer 
    End Function
    Then:
    Code:
    UPDATE tbl_PSA_Orders 
    SET tbl_PSA_Orders.Sub_Category = GetCommandPointer 
    WHERE (((tbl_PSA_Orders.Sub_Category) = GetCommandPointer) And ((tbl_PSA_Orders.fkeyPSA_ID) = [Forms]![Main_Sub_Items]![txtbox_SubItems_Ref_ID]))"
    Have a nice day!

  3. #3
    Join Date
    Sep 2010
    Location
    UK
    Posts
    160
    yep, that worked, thanks for your help
    Marcus

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •