DLookup in a datasheet form

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

    DLookup in a datasheet form

    I have tried everything, what am I doing wrong?

    I have a data entry form in datasheet view (for mass data entry). One of the
    fields are SalesID, and I would like to use DLookup to populate an unbound
    field next to it, just for information for the data entry person.

    I use:
    strFilter = "SalesRefID = " & Me!Salesid
    Me!Salesnavn = DLookup("SalesN ame", "SalesIDs", strFilter)

    This works fine, but it populates every record in the datasheet with the
    same name. How do I address one explicit row in my datasheet?


  • Rick Brandt

    #2
    Re: DLookup in a datasheet form

    "Knud Rogilds" <krogilds@hotma il.com> wrote in message
    news:407ffc26$0 $275$edfadb0f@d read11.news.tel e.dk...[color=blue]
    > I have tried everything, what am I doing wrong?
    >
    > I have a data entry form in datasheet view (for mass data entry). One of[/color]
    the[color=blue]
    > fields are SalesID, and I would like to use DLookup to populate an[/color]
    unbound[color=blue]
    > field next to it, just for information for the data entry person.
    >
    > I use:
    > strFilter = "SalesRefID = " & Me!Salesid
    > Me!Salesnavn = DLookup("SalesN ame", "SalesIDs", strFilter)
    >
    > This works fine, but it populates every record in the datasheet with the
    > same name. How do I address one explicit row in my datasheet?[/color]

    If you want it to be different "per-row" you cannot assign the value from
    code. You need to put the DLookup expression directly into the
    ControlSource of the unbound TextBox. Then each row will evaluate the
    expression using the value of SalesID found on the same row.


    --
    I don't check the Email account attached
    to this message. Send instead to...
    RBrandt at Hunter dot com



    Comment

    Working...