Solved

problems with union query

Posted on 2012-04-05
6
388 Views
Last Modified: 2012-04-05
I have the following union query behind a dropdown in access2007.

SELECT "(All)" As Section FROM tblCoversheets UNION Select [Section] FROM tblCoversheets WHERE CoverSheetDate = #"  & Me.cmbDateTime & "#"

Me.cmbDateTime comes from a dropdown that list the coverheetdates

When I click on the combobox that should list the sections I get the following
error: the microsoft database engine could not find the object 'coversheetdate = #" & Me.cmdDateTime & "&".

I have no idea why I'm getting this error.
Any help is most appreciated.
0
Comment
Question by:BauwensER
6 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 37809885
Where exactly is this sql expression located ?  The expression does not make sense as it is posted here because the combination of " being used render it invalid.
0
 

Author Comment

by:BauwensER
ID: 37809918
It is in the rowsource of the 2nd drop-down on a form.
Basicaly first the user select the date of the coversheet (1st drop-down) then
the user select the section(2nd drop-down).
I hope this is clear enough..
0
 

Expert Comment

by:Shiv_Sg
ID: 37809927
I am not an Access Expert but I see this double-quote (if it is a double-quote not 2 single quotes) WHERE CoverSheetDate = #" hanging in the air without an end quote, I would guess it should be

WHERE CoverSheetDate= "#"
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

Author Comment

by:BauwensER
ID: 37809949
I have now this as rowsource:

SELECT "(All)" As Section FROM tblCoversheets UNION Select [Section] FROM tblCoversheets WHERE CoverSheetDate = "#" & Me!cmbDateTime & "#" ORDER BY Section;

but when I open the dropdown I get a pop-up with Enter Parameter ValueMe!cmbDateTime
0
 
LVL 39

Accepted Solution

by:
als315 earned 500 total points
ID: 37809955
In rowsource you can't use Me!cmbDateTime. Use Combobox name without Me
Why you need there union query if both queries are from one table?
0
 

Author Comment

by:BauwensER
ID: 37809966
I just tried that but then I get the message that query is too complex to be evaluated.
(frustrating). I need the union because I need the string(All) so that users can print ALL coversheets if they need so.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Access 2010 db.Execute using dbFailOnError and dbSeeChanges 10 48
Microsoft Edge, Outlook OWA 7 41
Sub Reports 8 21
Restrict list data depending upon user name 3 20
Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
PaperPort has a feature called the "Send To Bar". It provides a convenient, drag-and-drop interface for using other installed software, such as Microsoft Office. However, this article shows that the latest Office 2016 apps (installed with an Office …
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

28 Experts available now in Live!

Get 1:1 Help Now