Link

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

    #1

    Link

    I have a main form where orders are placed for the user, I need to
    display the supplier account number on this main form. So I created a
    text box where the control source is SELECT DISTINCT AccountNumber FROM
    Suppliers WHERE
    (((AccountNumbe r)=forms!AddAnO rderAndDetails! CustomerID)); without any
    effect. Any ideas to make this work?

  • Allen Browne

    #2
    Re: Link

    You can't use a SQL statement in a ControlSource.

    Use DLookup(), e.g.:
    =DLookup("Accou ntNumber", "Suppliers" , "AccountNum ber = " &
    Nz(forms!AddAnO rderAndDetails! CustomerID,0))

    More info:
    Getting a value from a table: DLookup()
    at:
    How to use the DLookup() function to retrieve a value from a table in a Microsoft Access database.


    --
    Allen Browne - Microsoft MVP. Perth, Western Australia
    Tips for Access users - http://allenbrowne.com/tips.html
    Reply to group, rather than allenbrowne at mvps dot org.

    "Lee" <david_lcfc@hot mail.comwrote in message
    news:1169500544 .249338.205710@ 51g2000cwl.goog legroups.com...
    >I have a main form where orders are placed for the user, I need to
    display the supplier account number on this main form. So I created a
    text box where the control source is SELECT DISTINCT AccountNumber FROM
    Suppliers WHERE
    (((AccountNumbe r)=forms!AddAnO rderAndDetails! CustomerID)); without any
    effect. Any ideas to make this work?
    >

    Comment

    Working...