By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,665 Members | 1,900 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,665 IT Pros & Developers. It's quick & easy.

Insert records and search the records inserted

P: 5
Hi Compliments of the day,
I'm a new bie in vb and trying to write a class that'll insert & search a field but wen i run the program it says this: COMPILE ERROR: Sub or Function not defined.

Pls can someone assist me on how to go about it?

Thanks
Nov 2 '07 #1
Share this Question
Share on Google+
6 Replies


debasisdas
Expert 5K+
P: 8,127
How do you expect us to help you without knowing anything about your code and what exactly you are trying to do and how you are trying to connect to which database.
Nov 2 '07 #2

P: 5
Hi Compliments of the day,
I'm a new bie in vb and trying to write a class that'll insert & search a field but wen i run the program it says this: COMPILE ERROR: Sub or Function not defined.
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdLoad_Click()
  2.  
  3.     OpenDialog.CancelError = True
  4.     On Error GoTo ErrHandler
  5.  
  6.  
  7.     OpenDialog.DialogTitle = "Open File"
  8.     OpenDialog.Filter = "Text Files (*.txt)|*.txt"
  9.     OpenDialog.FilterIndex = 1
  10.     OpenDialog.ShowOpen
  11.     strFileName = OpenDialog.FileName
  12.     'OpenDialog.Flags = cdlOFNFileMustExist + cdlOFNHideReadOnly
  13.     Dim Called, Calling, Start, Stp, Duration, Incom, OutCom As String
  14.  
  15.  
  16.     Dim Stream As TextStream
  17.     Dim StrA As String
  18.     Dim RecA As String
  19.     Dim Record As String
  20.     Dim Rec As String
  21.     Dim i As Integer
  22.     Dim j As Integer
  23.  
  24.     'Try
  25.         Rec = ReadAll
  26.         For j = 0 To i - 1
  27.  
  28.             'Record = StrA(j)
  29.             RecA = Split(",")
  30.             Dim iLen As Integer
  31.             RecA = Length
  32.             Dim K As Integer
  33.             If j = i Then Exit For
  34.  
  35.  
  36.             Called = RecA
  37.             Calling = RecA
  38.             Start = RecA
  39.  
  40.             Stp = RecA
  41.             Duration = RecA
  42.             Incom = RecA
  43.             OutCom = RecA
  44.  
  45.             InsertRecord Into(Called, Calling, Start, Stp, Duration, Incom, OutCom)
  46.  
  47.         Next
  48.             OpenDialog.CancelError = True
  49.             On Error GoTo ErrHandler
  50.  
  51.             MsgBox("File Loaded Successfully", vbOKOnly, "File Upload") = vbOK
  52.  
  53.  
  54. End Sub
  55.  
  56.  
  57. Private Function InsertRecord(Caled As String, Calling As String, Start As String, EndTime As String, Duration As String, Inco As String, OutCo As String)
  58.     sSQL = "Insert into " & cbocity.Text & cboTraffic.Text & "Values('" & Caled & "','" & Calling & "','" & Start & "','" & _
  59.              EndTime & "','" & Duration & "','" & Inco & "','" & OutCo & "')"
  60.  
  61. End Function
Pls can someone assist me on how to go about it?

Thanks
Nov 2 '07 #3

debasisdas
Expert 5K+
P: 8,127
Both the threads are merged for better management of the forum.
Nov 2 '07 #4

debasisdas
Expert 5K+
P: 8,127
Are you trying to insert data into a database ?
Nov 2 '07 #5

P: 5
Yes I'm trying to insert it into a database

Thank you
Nov 2 '07 #6

debasisdas
Expert 5K+
P: 8,127
Yes I'm trying to insert it into a database

Thank you
1.Where is the conection string .
2.What is the output type of the function.
3.Why using a function where you don't actually need to return a value., which can be done in a procedure
4.Your SQL statment is wrong.
5.Why using INTO after the function name to call it .
6.Calling a function without any variable. It is not a procedure.

Take care of the above mentioned issues.
Nov 3 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.