How do I get at this fieldname?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tony Van

    How do I get at this fieldname?

    I have this SQL statement in my VB code...


    mySQL = "SELECT * FROM workord" & _
    " INNER JOIN customer ON workord.cust_nu m =
    customer.cust_n um" & _
    " WHERE workord.inv_num = '" & sInvNum & "'"

    rs.Open mySQL, myConnection, adOpenDynamic,
    adLockOptimisti c, adCmdText

    Basically doing an Inner Join on workord and customer via an
    invoice number field common
    to both.

    Problem is,both workord and customer have a field named
    "flag".
    Is there any way to access one (or the other) with ADO?

    Thanks for any help.


  • Max Healey

    #2
    Re: How do I get at this fieldname?

    MySQL will return the fields any ambigous fields with their table name dot
    field name so the following should work

    debug.print rs.fields("work ord.flag")
    debug.print rs.fields("cust omer.flag")

    or you could define the fields in your query

    eg "SELECT customer.flag AS CustomerFLAG, workord.flag AS workordFLAG " & _
    " INNER JOIN customer ON workord.cust_nu m =
    customer.cust_n um" & _
    " WHERE workord.inv_num = '" & sInvNum & "'"



    "Tony Van" <ton-jud-ann@comcast.net > wrote in message
    news:ud2dnQoEbY WuetveRVn-oA@comcast.com. ..[color=blue]
    >I have this SQL statement in my VB code...
    >
    >
    > mySQL = "SELECT * FROM workord" & _
    > " INNER JOIN customer ON workord.cust_nu m = customer.cust_n um" & _
    > " WHERE workord.inv_num = '" & sInvNum & "'"
    >
    > rs.Open mySQL, myConnection, adOpenDynamic, adLockOptimisti c, adCmdText
    >
    > Basically doing an Inner Join on workord and customer via an invoice
    > number field common
    > to both.
    >
    > Problem is,both workord and customer have a field named "flag".
    > Is there any way to access one (or the other) with ADO?
    >
    > Thanks for any help.
    >
    >[/color]


    Comment

    • Tony Van

      #3
      Re: fieldname? Thanks Max!

      Worked perfectly!


      Comment

      Working...