Solved

problems with union query

Posted on 2012-04-05
6
375 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

762 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

21 Experts available now in Live!

Get 1:1 Help Now