Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2002
    Location
    London
    Posts
    73

    Unanswered: Problems with Pass Through Query

    Hi,

    Just need some help i have a pass through query updating a sql table. (See below at query)

    UPDATE WATFORD_SHORT_PACK
    SET SH_ORDERADJUST = 1
    WHERE (((WATFORD_SHORT_PACK.SH_ORDERADJUST)=0 Or (WATFORD_SHORT_PACK.SH_ORDERADJUST) Is Null) AND (WATFORD_SHORT_PACK.SH_REF)=[Forms]![frmOrderReverse]![cboSON] Or [Forms]![frmOrderReverse]![cboSON] Is Null);

    Am getting an error

    ODBC - Call failed

    [Microsoft][ODBC SQL Server Driver][SQL Server] Line 3: Incorrect syntax near '!', (#170)

    I think it does not like the form criteria but not too sure. Has any one got any idea updating a pass through query with a form as a criteria?

    Thanks in Advance

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    You can't refer to the form in a pass through query. A pass through query is simply connection properties and an unparsed string. Access passes the unparsed string to the RDBMS to execute. Access knows nothing about the RDBMS, the RDBMS knows nothing about access. As such, you cannot refer to objects within Access in a pass through query.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Jan 2002
    Location
    London
    Posts
    73
    thank you for your help i will think of another way of doing this.

    Thanks

  4. #4
    Join Date
    May 2010
    Posts
    601
    If this is a saved query then you can use the VBA to modify the QueryDef() to substitute in the value fromt he form.
    Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

Posting Permissions

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