Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2004
    Location
    NH
    Posts
    4

    Unanswered: HELP WITH FORM and dlookup

    I am building a form based on a query. I have the query built, to return certain data, qryapplication10withstaff. I also have a separate table, tblbasestaffsummary,that I cannot link to in the query, no one to one relationship or any relationship. The query calculates the weekday, time and date from a crazy nom date the software that I am querying assigns.
    I have the form built with the query now I would like to pull data from my other table into the form based on criteria in the form.

    I tried dlookup function but cannot seem to get it to work:

    =dlookup("[staff]","[tblbasestaffsummary]","[weekday]= forms![weekday]" and "[time]= forms![time]")

    Any suggestions?

  2. #2
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Just make a subform where the data source is a query where the predicate references the control...

    Also make sure to requery the new subform on the event where the other controls data changes
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  3. #3
    Join Date
    Dec 2004
    Location
    NH
    Posts
    4
    I should have also stated that this is a continuous form. It list data per day from 00:00 to 23:30, in half hour periods. I think subforms can only go into single view forms. This is why I am attempting the dlookup.

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Open your quotes:

    =dlookup("[staff]","[tblbasestaffsummary]","[weekday]= forms![weekday]" and "[time]= forms![time]")

    should be:

    =dlookup("[staff]","[tblbasestaffsummary]","[weekday]= forms![weekday] and [time]= forms![time]")

    another version:
    =dlookup("[staff]","[tblbasestaffsummary]","[weekday]= " & forms![weekday] & " and [time]= " & forms![time])

    Criteria for dlookup is basically a where clause and therefore expects valid sql.
    Last edited by Teddy; 01-03-05 at 15:41.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  5. #5
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi

    I am not sure that '=dlookup("[staff]","[tblbasestaffsummary]","[weekday]= " & forms![weekday] & " and [time]= " & forms![time])' will work !

    Shouldn't it be

    =dlookup("[staff]","[tblbasestaffsummary]","[weekday]= " & forms![formname].[weekday] & " and [time]= " & forms![formname].[time]) ??

    However if [weekday] and [time] are field names in the form control source query (or control names on the form), and the DLookup is the control source of an unbound control, then try

    =DLookup("[staff]","[tblbasestaffsummary]","[weekday]= " & [weekday] & " and [time]= " & [time])


    Hope this has not confused the issue !!

    MTB

Posting Permissions

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