|
-
Aug 5th, 2005, 04:14 AM
#1
Thread Starter
New Member
User Defined Functions Error ....
Hi Friends,
I am working on Project Using VB 6.0 & MS Access 2000..
I am using ADO for Database connection...
Problem is while Executing the below qry, I am getting error...
Qury Name: qry_GenerateInvoice
In Access:-
"SELECT IIf(IsNull(Max([Sales]![InvoiceNo])),fnFormatDate(Date()),Max([Sales]![InvoiceNo]))+1 AS Expr1 FROM Sales WHERE (((Sales.InvoiceNo)>fnFormatDate(Date())));"
In query, fnFormatDate is Function written in Access Module...
While executing the query from VB, I am getting error Invalid SQL Statement expecting INSERT, UPDDATE OR SELECT STATEMENT.... While I further working on this, I am getting error - UNDEFINED FUNCTION 'fnFormatDate'EXPRESSION
How to solve this problem?
Mainly I need solution that whether I call functions of Access Module using Select Statement from VB 6.0
FYI: This Query work fine in Access
Thanxs in advance..
-
Aug 5th, 2005, 04:26 AM
#2
Re: User Defined Functions Error ....
It would be best if you showed us the code from the function..
I'm guessing that this is not a date returned value due to the Sales.InvoiceNo..
You can also reduce your SQL down to..
"SELECT IIf(IsNull(Max(InvoiceNo)),fnFormatDate(Date()),Max(InvoiceNo))+1 AS Expr1 FROM Sales WHERE InvoiceNo>fnFormatDate(Date());"
Danny
Never Think Impossible
If you find my answer helpful then please add to my reputation
-
Aug 8th, 2005, 04:31 AM
#3
Re: User Defined Functions Error ....
It works in access, because in access you can call custom functions in the sql statement.
However in VB either it doesn't let you use custom functions in the access database, or your custom function is in the vb side and not in the access mdb side, so it cannot find it.
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|