Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old March 8th, 2005, 12:45 AM
archana badera archana badera is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 2 archana badera User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 26 m 23 sec
Reputation Power: 0
Question Calling Function defined in MS Access (.bas module) from VB code

Hi,

I have written function in .bas module in MS Access to get the alphanumeric strings from my table

Function
Public Function Alphanumeric1(textstring As String) As Boolean
Dim n As Integer, numFlg As Boolean, txtFlg As Boolean
Dim nChr As String, nAsc As Integer

For n = 1 To Len(textstring)
nChr = Mid(textstring, n, 1)
nAsc = Asc(UCase(nChr))

If IsNumeric(nChr) Then
numFlg = True
ElseIf nAsc > 64 And nAsc < 91 Or nAsc > 97 And nAsc < 122 Then
txtFlg = True
Else
txtFlg = False
Exit For
End If
Next

Alphanumeric1 = numFlg And txtFlg
End Function
__________________________________________________ ________________________
Table in the database on which I am running the query
tblData
DataUniqueId SourceCode PromoCode
1 abcd1 123
2 dfer$% 445
3 sff%3s 345
4 xyz 347
__________________________________________________ _________________________
When I call this function from the query which is run from Query window in MS Access, it work properly
Query:

Select * from tblData where Alphanumeric1(SourceCode) <>0
__________________________________________________ _________________________

But when I call this query from Visual Basic code using ADO objects, it gives me an error like
"Undefind function 'Alphanumeric1' ..."

__________________________________________________ __________________________

Could anybody help me in resolving this error?

Reply With Quote
  #2  
Old March 8th, 2005, 09:19 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 21 h 12 m 35 sec
Reputation Power: 180
Basically you can't call user functions in Access from outside Access using ADO.
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
  #3  
Old March 8th, 2005, 10:55 PM
archana badera archana badera is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 2 archana badera User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 26 m 23 sec
Reputation Power: 0
Question

Quote:
Originally Posted by Doug G
Basically you can't call user functions in Access from outside Access using ADO.


Thanks Doug!
Is it that you can' call them by any other means? Or just using ADO, it is not possible? Could you please clarify?

Reply With Quote
  #4  
Old March 9th, 2005, 11:46 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
Just put your function in an Access Module

S-
__________________
If you have found a particular post helpful, show your appreciation by adding reputation points to that user by clicking the "scales" image in the upper right had corner of their post.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Calling Function defined in MS Access (.bas module) from VB code


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway