I have a main form and a subform that have no record selected.
The main form has a combo box that updates the subform using a query (based on name selected). This works fine.
I then added the ability to sue this same query in VBA uo pull data using DLOOKUP into some unbound boxes on the subform, so Day1, Day2, Day3 displays information from the selected table in the query.
Behind the scenes the query runs as it should, pulls the appropriate records for the selected name, but the problem is that only Day1 on the subform displays the infromation. Even though the query shows data for Day2, Day3, etc it is not shown.
Do I need to do anything to my forms/subforms to get this to work. I have tested using just Day2 or Day3 and this works fine, but again only one record is shown at a time.
I'm not sure to understand. However, if Day1, Day2, Day3 are values from a column on different rows of the data set returned by the query, this is normal: without any proper criteria, DLookUp() returns data from an arbitrarily selected row in the domain (usually the first but it's not garanteed). From http://office.microsoft.com/en-us/ac...01228825.aspx:
The DLookup function returns a single field value based on the information specified in criteria. Although criteria is an optional argument, if you don't supply a value for criteria, the DLookup function returns a random value in the domain.
Please explain how the query is built (SQL statement) and also the line of code where the DLookUp function is used.