RE: Unbound Combo Box Default Value Based on Query

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I would guess the problem is elsewhere. Test by removing the default
statement to see if you still get the error message.

"ScottMsp" wrote:

Karl,

I went ahead and put in brackets as you suggested:
=SELECT Max([qPayPeriodDateUnique].[PPD]) as MaxDate FROM
qPayPeriodDateUnique;

This is put in the Default Value section of the Combo box under the Data Tab

I am still getting error message, "The syntax of the subquery in this
expression is incorrect. Check the subquery's syntax and enclose the
subquery in parentheses."

I am wondering what I am still missing.

Thanks in advance.
-Scott


"KARL DEWEY" wrote:

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: Unbound Combo Box Default Value Based on Query
    ... "ScottMsp" wrote: ... "The syntax of the subquery in this expression is incorrect. ... I have a query based on a table. ...
    (microsoft.public.access.formscoding)
  • Re: Can I populate a control with the record number?
    ... But I get an error message that says "Syntax of subquery is incorrect check ...
    (microsoft.public.access.forms)
  • Re: Simple copy but getting error
    ... What is the /G switch for? ... If you get a "path too long" error message then you must ... This was my syntax: ... Let's have a look at your xcopy syntax! ...
    (microsoft.public.win2000.general)
  • Re: OT: Bush Leaving Town
    ... "bad syntax" "error message? ... Pat. ... Did you read what I wrote, Bill? ... click on one of these referrals, I get the "bad syntax" error ...
    (rec.bicycles.tech)
  • Re: error: unknown field `close specified in initializer
    ... >see from the error message, is that the compiler doesn't understand ... >'struct file_operations' to make sure that that structure really does ... At first I had absolutely no idea what the OP's "open:" syntax ... struct file_operations fops = { ...
    (alt.comp.lang.learn.c-cpp)