I'm trying to get the sqltext query below in a format that VB will accept, it is coded on a button in access. When I type it in, with all quotes around it along with the " & _ things, I still get errors. I'm wondering if i'm missing something because of the internal parentheses. Please help. here is the query. I've taken out all of the quotes and other connotations that didn't help.
thanks in advance. - Dim sqltext As String
-
-
sqltext = select * from " & _
-
(Select type,shortname as Ward, abbrev,email,schedule.rotation, schedule.acyear, dbo.idtoname(schedule.eid) name, schedule.eid , min(startdate) start, " & _
-
-
sum(DateDiff(d, startdate, enddate) + 1) As nodays " &_
-
-
from schedule, serviceward, employee " & _
-
-
where schedule.srvcode = serviceward.srvcode
-
-
and schedule.eid = employee.eid
-
-
and hosp='U' and type=1 and schedprt=1
-
-
and acyear = " & Me.CbxAcyear" and rotation between " & Me.cbxMonth" -1 and " & Me.CbxMonth" and stfgroup=1
-
-
-
-
Group by type, shortname, schedule.eid, email, schedule.rotation, schedule.acyear, abbrev
-
-
) A
-
-
where nodays >= 10
-
-
and datepart(ww,start) = datepart(ww,getdate())+1
2 1073
What, exactly, are the error messages that you are getting. It will help narrow down the error if we know what error is occuring.
One immediate thing I can see is in line 3
there is a missing quote
it should be -
sqltext = "select * from " & _
-
-
NeoPa 32,556
Expert Mod 16PB
Teneesh, A couple of important points. - Always use [ CODE ] tags when posting code. This is not optional and you're a full member now so you should know this (The rules are not hidden).
- When posting code for review, always make sure that you copy/paste the actual code tested. This has not been tested as posted as it couldn't possibly run (or even compile). Trimming the code is a good thing, but if it means we're looking at code that's never been checked to see if it does what you describe, then that extra effort is more than wasted.
- Always compile code before posting it.
- If there are compile errors then report the error fully and say which line (in the post - not in the module) that the error occurs on.
If you follow these simple instructions you'll find that your questions are answered more often and more correctly (and there won't be so many requests for extra information).
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Ross Presser |
last post by:
The purpose, as you can probably guess, is to produce a set of sample
documents from a large document run. The data row has a CLUB column and an
IFC column; I want a set of samples that contains...
|
by: David |
last post by:
Hi everyone.
I have read every page that Google returns on this topic, but can't find
anything that resolves my problem.
Basically, I have an Access Database that does a number of different...
|
by: Mark B |
last post by:
We have an Access app (quite big) at www.orbisoft.com/download.
We have had requests by potential users to have it converted to an SQL
version for them since there corporate policy excludes them...
|
by: s_wadhwa |
last post by:
Hi,
I'm trying to convert MS Access 97 .mdb application to Access 2003 .adp
application with SQL Server as Backend.
I'm having trouble converting Access Query into SQL Query. The Query is...
|
by: Craash |
last post by:
I understand this is an access forum so I apologize if this is inappropriate.
I have an excel spreadsheet that I have created a query using a DSN to access a sql database. My question; is there a...
|
by: timn |
last post by:
Translating Access SQL queries into SQL subqueries.
--------------------------------------------------------------------------------
I have a query in Access that uses a subquery, I would like...
|
by: gary0gilbert |
last post by:
An unusual spin to this recurring disk or network error in a Terminal
Server environment. Access 2000, Terminal Server 2000, file server is
windows 2000. All users have a separate copy of the...
|
by: bobh |
last post by:
Hi All,
Is there a difference in preformance between the two;
TblNme has 36 fields across a record
a query that selects all fields and the report only uses 75% of the
fields, ie; Select...
|
by: =?Utf-8?B?VmlqYXkgQ2hpa3Rl?= |
last post by:
Hi Experts,
With Session Affinity and Web Server Farm on ISA Server 2006 accessing 2
backend IIS servers, I’m getting error “Validation of ViewState MAC failed.
If this application is hosted...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |