RE: Unbound Combo Box Default Value Based on Query

Tech-Archive recommends: Speed Up your PC by fixing your registry



You are missing brackets -- [ ]
=SELECT Max([qPayPeriodDateUnique].[PPD]) As MaxDate FROM
qPayPeriodDateUnique;


"ScottMsp" wrote:

Karl,

I tried your solution, but it did not work. I kept getting a syntax error
message saying, "The syntax of the subquery in this expression is incorrect.
Check the subquery's syntax and enclose the subquery in paratheses."

My line in the Default Value was:
=SELECT Max([qPayPeriodDateUnique.PPD]) As MaxDate FROM qPayPeriodDateUnique;

I tried parathesis in a few places, but could not get it to work.

I am sure it works, but it just did not work for me.

Thanks for responding and trying.

-Scott

"KARL DEWEY" wrote:

Try copying the query you are using as source for the combo to the Default
property and edit to something like this --
=SELECT Max([YourDateField]) AS MaxDate FROM YourTable;

"ScottMsp" wrote:

Hello,

I have a query based on a table. The query has one field and it is the date
the data was loaded. The query limits it to unique values as I wanted to
only see the four different dates that are loaded on the 50k+ records.

On a form in a combo box, I have been able to display those dates and select
from them which then drives other queries.

My question then is, I want the default value of the combo box to always
default to the most current date in the table. For instance if I have 4
dates (5/4/2008, 6/1/2008, 8/1/2008, and 4/5/2009), I want 4/5/2009 to be the
default value. When I load more records into the table that have a newer
date, I want the default value to be the new date.

Thanks in advance for all your help.
.



Relevant Pages

  • Re: Bizarre subquery syntax problem
    ... With Access, the official syntax for a subquery always requires an alias, so ... SELECT p.AS UID, p.Firstname AS Firstname, p.Lastname AS Lastname, ... I am seeing bizarre problems with a subquery. ... core query runs fine- ...
    (microsoft.public.access.queries)
  • RE: EXISTS reserved word in FROM clause
    ... we make a good pair because I know Access SQL ... from what you described the query syntax that I ... >The subquery should return the records: ...
    (microsoft.public.access.queries)
  • RE: Unbound Combo Box Default Value Based on Query
    ... "ScottMsp" wrote: ... I am still getting error message, "The syntax of the subquery in this ...
    (microsoft.public.access.formscoding)
  • Re: INNER JOIN auto changes
    ... That bracket syntax was required for A97 and, I think, A2000. ... subquery as you did. ... the query before it changes: ...
    (microsoft.public.access.queries)
  • Re: syntax error in Total of field - I need help ASAP, PLease
    ... "check the subquery's syntax and enclose the subquery in parentheses". ... "SELECT Rent, FROM PO 1189-616) as Rent Sum ... you posting the entire SQL (query) statement? ... IF you are trying to use a subquery in the select clause of a query then ...
    (microsoft.public.access.queries)