Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Oggie
 
Posts: n/a
Default Query a Access database that has a module from Excel

I'm very new to most SQL, VB, etc. and I think this is pretty simple so I
hope someone can help!!!

I have a database that I store all of my research data in, then I query it
in Excel to do analysis. I've put in a function that I found from the
Microsoft KnowledgeBase to find the minimum value across various fields in
ONE record. However, when I try to query the database now it gives me a
"Undefined function in expression" message.

I've read around and now realize that the modules aren't part of the
Microsoft Jet Database (or something like that!!) and thus cannot be seen.
I've also read that the likely solution is to use SQL to do the same thing,
unfortunately I'm having trouble finding any resource that will explain SQL
at my level!!!!

Can anyone help me write the same function in SQL??? Below is the code that
I was using. Thank you so much in advance.

Oggie

Function Minimum(ParamArray FieldArray() As Variant)
' Declare the two local variables.
Dim I As Integer
Dim currentVal As Variant

' Set the variable currentVal equal to the array of values.
currentVal = FieldArray(0)

' Cycle through each value from the row to find the smallest.
For I = 0 To UBound(FieldArray)
If FieldArray(I) < currentVal Then
currentVal = FieldArray(I)
End If
Next I

' Return the minimum value found.
Minimum = currentVal

End Function
  #2   Report Post  
onedaywhen
 
Posts: n/a
Default


Oggie wrote:
I'm very new to most SQL, VB, etc. and I think this is pretty simple

so I
hope someone can help!!!

I have a database that I store all of my research data in, then I

query it
in Excel to do analysis. I've put in a function that I found from

the
Microsoft KnowledgeBase to find the minimum value across various

fields in
ONE record. However, when I try to query the database now it gives

me a
"Undefined function in expression" message.

I've read around and now realize that the modules aren't part of the
Microsoft Jet Database (or something like that!!) and thus cannot be

seen.
I've also read that the likely solution is to use SQL to do the same

thing,
unfortunately I'm having trouble finding any resource that will

explain SQL
at my level!!!!

Can anyone help me write the same function in SQL??? Below is the

code that
I was using. Thank you so much in advance.

Oggie

Function Minimum(ParamArray FieldArray() As Variant)
' Declare the two local variables.
Dim I As Integer
Dim currentVal As Variant

' Set the variable currentVal equal to the array of values.
currentVal = FieldArray(0)

' Cycle through each value from the row to find the smallest.
For I = 0 To UBound(FieldArray)
If FieldArray(I) < currentVal Then
currentVal = FieldArray(I)
End If
Next I

' Return the minimum value found.
Minimum = currentVal

End Function


All implementations of SQL should have a MIN (minimum) set function
e.g.

SELECT MIN(MyCol) AS min_value FROM MyTable;

Jamie.

--

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access Module coded converted to Excel Function Adam Excel Discussion (Misc queries) 1 December 23rd 04 02:48 PM
Converting an Excel formula to an Access query formula Adam Excel Discussion (Misc queries) 1 December 15th 04 03:38 AM
How to use a Access Query that as a parameter into Excel database query Karen Middleton Excel Discussion (Misc queries) 1 December 13th 04 07:54 PM
Excel aficionado wants to learn Access Hari Excel Discussion (Misc queries) 0 December 3rd 04 05:45 AM
Excel user desires to learn ABC of Access Hari Excel Discussion (Misc queries) 1 December 3rd 04 02:32 AM


All times are GMT +1. The time now is 09:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"