|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
User Function in Query !
Hi all
My Front end is VB (6) and back end is Access (2000) I have a Query written in Access which uses a user function. When I try to use the Query in VB, it gives me a error saying that the user function could not be found. My queries regarding the same 1) How can I use this Query in VB 2)If not than how do write such a query in VB itself ------------------------------------------------ The Query (Tenders (db) - QryCheckStatus ) in Access is as follows ------------------------------------------------ SELECT T1.* FROM Tenders AS T1 WHERE (((RevisionNumber([T1].[CAERef]))=(Select MAX (RevisionNumber(T2.CAERef)) from Tenders as T2 where TenderNumber(T2.CAERef) = TenderNumber(T1.CAERef)))); --------------------------------------------- The function in access is as follows --------------------------------------------- Function RevisionNumber(strRefNo As String) As Integer Dim intHyphenPos As Integer intHyphenPos = InStr(1, strRefNo, "-") If intHyphenPos > 0 Then RevisionNumber = Val(Mid$(strRefNo, intHyphenPos + 1)) Else RevisionNumber = 0 End If End Function --------------------------------- And this is my code in VB --------------------------------- Private Sub AlarmCheckStatus() Dim mydb As Database Dim mydyn As Recordset On Error GoTo err_handler Set mydb = OpenDatabase("C:\Tenders\Tenders.mdb") Set mydyn = mydb.OpenRecordset("Select * from QryCheckStatus ") ' some more code err_end: mydyn.Close mydb.Close Exit Sub err_handler: MsgBox Err.Number & Err.Description End Sub Thanks for reading the Query M.L |
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > User Function in Query ! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|