Parameter

B

byeo

I have a query that returns only the latest date in a table (1 record). I
would like to pass this date to a form I am using that prompts the user to
enter a date to view.

SELECT TOP 1 [1Daily Sales].[Report Date]
FROM [1Daily Sales]
GROUP BY [1Daily Sales].[Report Date]
ORDER BY [1Daily Sales].[Report Date] DESC;

I was able to get the date to pass to a text box with what I think is a
"bound" form (created with the wizard based on the query) BUT, I want the
user to be able to type a different date if they choose, this bound form
doesn't allow that.

From reading posts on parameters all say use an unbound form - when I try
that, I get a #Name? error in the text box whose control source is the the
query result.

Is what I'm trying possible? I appreciate any help to point me in the right
direction - I'm not that comfortable with code so if that is the answer it
would help if you were pretty specific.

Thanks!
 
D

Dennis

I have a query that returns only the latest date in a table (1 record). I
would like to pass this date to a form I am using that prompts the user to
enter a date to view.

SELECT TOP 1 [1Daily Sales].[Report Date]
FROM [1Daily Sales]
GROUP BY [1Daily Sales].[Report Date]
ORDER BY [1Daily Sales].[Report Date] DESC;

I was able to get the date to pass to a text box with what I think is a
"bound" form (created with the wizard based on the query) BUT, I want the
user to be able to type a different date if they choose, this bound form
doesn't allow that.

From reading posts on parameters all say use an unbound form - when I try
that, I get a #Name? error in the text box whose control source is the the
query result.

Is what I'm trying possible? I appreciate any help to point me in the right
direction - I'm not that comfortable with code so if that is the answer it
would help if you were pretty specific.

Thanks!
 
B

byeo

This gives me the first date in the 1Daily Sales table but it still won't let
me change the date when it populates on the form. There are multiple
duplicate report dates in the daily sales table, these must be grouped and
the latest date should populate the form text box. The goal is to let the
user either accept the date and run the report or change the date to view a
different report date.


Dennis said:
I have a query that returns only the latest date in a table (1 record). I
would like to pass this date to a form I am using that prompts the user to
enter a date to view.

SELECT TOP 1 [1Daily Sales].[Report Date]
FROM [1Daily Sales]
GROUP BY [1Daily Sales].[Report Date]
ORDER BY [1Daily Sales].[Report Date] DESC;

I was able to get the date to pass to a text box with what I think is a
"bound" form (created with the wizard based on the query) BUT, I want the
user to be able to type a different date if they choose, this bound form
doesn't allow that.

From reading posts on parameters all say use an unbound form - when I try
that, I get a #Name? error in the text box whose control source is the the
query result.

Is what I'm trying possible? I appreciate any help to point me in the right
direction - I'm not that comfortable with code so if that is the answer it
would help if you were pretty specific.

Thanks!
 
J

John Spencer

You could try setting the Default value of an unbound CONTROL to
=DMax("Report Date","1Daily Sales")
 
B

byeo

Thanks John - that works!

John Spencer said:
You could try setting the Default value of an unbound CONTROL to
=DMax("Report Date","1Daily Sales")


byeo said:
I have a query that returns only the latest date in a table (1 record). I
would like to pass this date to a form I am using that prompts the user to
enter a date to view.

SELECT TOP 1 [1Daily Sales].[Report Date]
FROM [1Daily Sales]
GROUP BY [1Daily Sales].[Report Date]
ORDER BY [1Daily Sales].[Report Date] DESC;

I was able to get the date to pass to a text box with what I think is a
"bound" form (created with the wizard based on the query) BUT, I want the
user to be able to type a different date if they choose, this bound form
doesn't allow that.

From reading posts on parameters all say use an unbound form - when I try
that, I get a #Name? error in the text box whose control source is the the
query result.

Is what I'm trying possible? I appreciate any help to point me in the
right
direction - I'm not that comfortable with code so if that is the answer it
would help if you were pretty specific.

Thanks!
 
Top