July 28, 2004 at 9:07 am
Hi,
How can I use a VB function as part of a comparison of a query
I am using importing data into excel from access and I need to use a function to define the paramteres of the query.
Here is the SQL code:
SELECT `2004`.`INVOICE DATE`, `2004`.`ITEM NUMBER`, `2004`.QTY, `2004`.`EXT PRICE`, `2004`.`SALES REP`
FROM `C:\MAS90REPORTS\SALESANALYSIS\REPORT`.`2004` `2004`
WHERE (`2004`.`INVOICE DATE`>=? And `2004`.`INVOICE DATE`<=?)
and by the way, what do the "?" marks mean ?
Any help would be appreciated
July 29, 2004 at 8:09 am
I don't think you can use VB functions in an MS Access query, but you might be able to use VBA functions. Which functionality are you trying to achieve?
As far as the SQL code you posted, it's not real SQL, but a MS Access version of SQL. The ?'s are for input parameters I believe - letting the user supply some date value to compare against at runtime. You could probably hardcode some date value in the form of #1/1/2004# (access likes the # marks) or whatever date makes sense in your query.
hope this helps...
anyone else? comments, questions, snide remarks?
July 29, 2004 at 10:01 am
You can't use a VB function in SQL, but many of them are duplicated in SQL Server.
July 29, 2004 at 10:19 am
Create an ODBC database connection pointing to your Access database. Go to Excel and use DATA | IMPORT EXTERNAL DATA | NEW DATABASE QUERY. On the third page in the wizard choose to filter your data occordingly.
July 29, 2004 at 10:21 am
Ooops! That word is accordingly
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply