473,516 Members | 2,771 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help using recordset to insert data into a table **URGENT**

38 New Member
Hi im creating a function to insert data from a MYOB file into an Access database. what im trying to do is copy entire tables from MYOB into ACCESS.
Im using a simple Access Database with so there is no back end, the table are part of the front end

i have a button to run this code

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command0_Click()
  2.  
  3. Dim oRS As ADODB.Recordset
  4. Dim DSN As String
  5. Dim connection
  6. Dim sql, sconstring
  7.  
  8.  
  9. DSN = "TEST"
  10.  
  11. sql = "SELECT LineTypeID FROM SaleLines"
  12.  
  13. sconstring = "Driver:={MYOB ODBC};DSN=" & DSN & ";"
  14.  
  15. Set connection = CreateObject("ADODB.Connection")
  16.  
  17. connection.Open (sconstring)
  18. Set oRS = connection.Execute(sql)
  19.  
  20.  
  21. While Not oRS.EOF
  22.  
  23. DoCmd.RunSQL "INSERT into Test (LineTypeID) VALUES(" & oRS("LineTypeID") & ")"
  24.  
  25. oRS.MoveNext
  26. Wend
  27.        MsgBox "Completed"
  28. End Sub
  29.  
The Problem is that when i run it, from a form an input box appears with the title input paramater value
and a D in the grey area above the input field. the actual value of LineTypeID is D, and i want this inserted into the table, but the input box appears. Does anybody know why it does this and more importantly, how to make it work properly???

This is really a pain, to insert this way, if someone know how to use bulkinsert from from MYOB that would help healp
Apr 18 '07 #1
2 7149
tezza98
38 New Member
i feeel likea real idiot now, i solved the problem by binding the oRS value to a variable, and that fixed the problem,(its always the last thing you try)the only problem i have now is that for every row this yes/no message appears

waring you are about to append 1 row(s)

anybody know how to remove it???
Apr 18 '07 #2
neoabacus
1 New Member
right before you start your inserts issue this command

DoCmd.SetWarnings False


then right after your done issue this command

DoCmd.SetWarnings True
May 24 '07 #3

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

Similar topics

1
2167
by: Pratik Gupte | last post by:
I have created a database in .mdf format, but I am unable to insert data into its tables. Can anybody help how to insert data using ASP.Net 2.0 using SQL Server 2005 Express edition in windows integrated security mode. thx
1
1597
by: Kwok | last post by:
In my project... which deadline is July 3 .... I need to design a very simple database.... which can enter some subject or subheading in a document to a data table in MS access. I use VB to implement this, tsubject <-- is the text box name the code show as follow: "INSERT INTO data (subject) values ("""+trim(Me.tsubject)+""");" I think...
0
1371
by: swatijogdand | last post by:
how to insert data in a linked table through a pass through query? pass through query and linked table are attached to the access database at runtime.Also ,pass through query contains stored procedures. can it be done without giving 'insert permissions' on stored procedures? plz help... it's urgent thx in advance, swati
2
2662
by: Deven Oza | last post by:
hi all i want to insert data like TITLE YEAR PUBLISHER COVER TYPE EDITION Statistics 1995 McGraw Hill Hardcover 5 in TABLE name PUBLISHED , i am getting problem for year so please help me how insert data in the table. thanks dboza
0
2201
by: tezza98 | last post by:
HI i am using BULK INSERT to copy data from a text file into a table that already exists BULK INSERT dbo.TRANStemp FROM 'D:\MSSQL\Data\TRANS.csv' WHERE dbo.TRANStemp.DateTime <> WITH ( FIRSTROW = 2, FIELDTERMINATOR = '\t',
1
11608
by: Thayyil | last post by:
i am new with cake php ..any body can help me to insert data into database
2
9249
by: mustang123 | last post by:
Hi, I get data from sybase server using ADO Connection and disconnected recordset in my access Database. Now I have a disconnected recordset. I want to insert the contents of this recordset into a Access table. I can loop through the recordset and insert record by record. But I want to do a bulk insert/Update assuming the columns are the...
1
1547
by: aritra2008 | last post by:
Hi, Can anybody tell me how can I insert multiple data in a data table of a database using DataGridView control in VB/ASP.Net? It is very urgent for me to know. Kindly anybody help me with a code snippet. Aritra.
1
1665
by: sarah2855 | last post by:
I have opened a recordset and now I want to copy all the records of that recordset to a table. set rs = db.OpenRecordset("SELECT ID FROM Customers") This command gives me the list of all Ids in Customer Table. How can I now Insert this list in to a table?
0
7276
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7408
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7581
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7142
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7548
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3259
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1624
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
825
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.