Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
CLamar
 
Posts: n/a
Default Undefined function error

I keep getting the undefined function error when executing my code, although
it has already been defined. both functions are defined as public sub


  #2   Report Post  
Posted to microsoft.public.excel.misc
CLR
 
Posts: n/a
Default Undefined function error

Post your code.......maybe someone can help.

Vaya con Dios,
Chuck, CABGx3



"CLamar" wrote:

I keep getting the undefined function error when executing my code, although
it has already been defined. both functions are defined as public sub


  #3   Report Post  
Posted to microsoft.public.excel.misc
CLamar
 
Posts: n/a
Default Undefined function error



"CLamar" wrote:

I keep getting the undefined function error when executing my code, although
it has already been defined. both functions are defined as public sub. InitialSelec inside the SQL statement with the asterisks is when the undefined error pops up.

Function InitialSelec()
'Assigns the selected value inside the List Box to a variable
For w = 0 To Sheets("Sheet1").LstBatchnum.ListCount - 1
If Sheets("Sheet1").LstBatchnum.Selected(w) Then _
Selec = Selec & Sheets("Sheet1").LstBatchnum.List(k)
InitialSelc = Selec
Next w
End Function


Set Recordset = New ADODB.Recordset

With Recordset
Call InitialSelec
**Src = "SELECT * FROM tblResults WHERE Batch = InitialSelec()"
.Open Source:=Src, ActiveConnection:=Connection2

'For Col = 0 To Recordset.Fields.Count - 1
' Sheets("Sheets3").Range("A1").Offset(0, Col).Value =
Recordset.Fields(Col).Name
'Next

Sheets("Sheet3").Range("A1").Offset(1, 0).CopyFromRecordset
Recordset

'Copies the data inside the recordset into a List Box
For Row = 2 To Recordset.Properties.Count - 1
Sheets("Sheet1").LstTirenum.AddItem
Sheets("Sheet3").Cells(Row, 4)
Next Row

End With
  #4   Report Post  
Posted to microsoft.public.excel.misc
CLR
 
Posts: n/a
Default Undefined function error

Maybe..........
InitialSelec = Selec

instead of
InitialSelc = Selec

Vaya con Dios,
Chuck, CABGx3



"CLamar" wrote:



"CLamar" wrote:

I keep getting the undefined function error when executing my code, although
it has already been defined. both functions are defined as public sub. InitialSelec inside the SQL statement with the asterisks is when the undefined error pops up.

Function InitialSelec()
'Assigns the selected value inside the List Box to a variable
For w = 0 To Sheets("Sheet1").LstBatchnum.ListCount - 1
If Sheets("Sheet1").LstBatchnum.Selected(w) Then _
Selec = Selec & Sheets("Sheet1").LstBatchnum.List(k)
InitialSelc = Selec
Next w
End Function


Set Recordset = New ADODB.Recordset

With Recordset
Call InitialSelec
**Src = "SELECT * FROM tblResults WHERE Batch = InitialSelec()"
.Open Source:=Src, ActiveConnection:=Connection2

'For Col = 0 To Recordset.Fields.Count - 1
' Sheets("Sheets3").Range("A1").Offset(0, Col).Value =
Recordset.Fields(Col).Name
'Next

Sheets("Sheet3").Range("A1").Offset(1, 0).CopyFromRecordset
Recordset

'Copies the data inside the recordset into a List Box
For Row = 2 To Recordset.Properties.Count - 1
Sheets("Sheet1").LstTirenum.AddItem
Sheets("Sheet3").Cells(Row, 4)
Next Row

End With

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
How too set last edited date in excel and which user was it? jinlarse Excel Worksheet Functions 5 March 23rd 06 02:26 PM
Why sometimes excel returns error just because function parameters are linked? Paul134 Excel Worksheet Functions 2 February 28th 06 05:15 PM
Function giving error Martin Excel Discussion (Misc queries) 3 October 1st 05 12:58 PM
Function giving Error Martin Excel Worksheet Functions 3 October 1st 05 03:49 AM
Custom function returning VALUE error alex.k Excel Discussion (Misc queries) 6 September 27th 05 03:05 AM


All times are GMT +1. The time now is 06:55 AM.

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

About Us

"It's about Microsoft Excel"