473,322 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Insert records and search the records inserted

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
6 1307
debasisdas
8,127 Expert 4TB
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
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
8,127 Expert 4TB
Both the threads are merged for better management of the forum.
Nov 2 '07 #4
debasisdas
8,127 Expert 4TB
Are you trying to insert data into a database ?
Nov 2 '07 #5
Yes I'm trying to insert it into a database

Thank you
Nov 2 '07 #6
debasisdas
8,127 Expert 4TB
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

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

Similar topics

4
by: DTB | last post by:
I am having trouble creating an INSTEAD OF trigger in SQL Server to replicate a BEFORE UPDATE trigger from ORACLE. Here is a sample of the ORACLE BEFORE UPDATE trigger: CREATE TRIGGER myTRIGGER ON...
2
by: george | last post by:
This is like the bug from hell. It is kind of hard to explain, so please bear with me. Background Info: SQL Server 7.0, on an NT box, Active Server pages with Javascript, using ADO objects. ...
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
10
by: Mike | last post by:
I know this sounds strange but I am at a loss. I am calling a simple funtion that opens a connection to a SQL Server 2000 database and executes an Insert Statement. private void...
2
by: r_o | last post by:
hi i'm new to this issue i'm developping a web application with an access database in my application there's a loop that gets values of a form like: lastElt=request("numberOfItems") for...
1
by: gmccallum | last post by:
I would have expected to be able to find this easily, but I couldn't. I am using the TableAdapter.Insert command to insert a record. I would like to then get an ID field from that record after...
1
by: new | last post by:
I am building an effective dated file that shows results to date. In part 1 of the select I I process a larges set of input and genrate records for each date in the processing period for which...
10
by: MLH | last post by:
Suppose, in a multi-user environment, you have append query SQL in a VBA procedure that looks like INSERT INTO MyTable... and the next line reads MyVar=DMax("","MyTable... You can never be...
2
by: leedo | last post by:
Hi, I am almost going crazy with this. I have a table that I bulk insert into from another database using VS2005. I need to change the data in the records before committing the values in the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.