473,404 Members | 2,137 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,404 software developers and data experts.

run time error '6160' data access error ??

Hi all,
why got this error message when run the program??
anyone help is much appreciated.

Line 28 error.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Prn2_Click()
  2.  
  3. Dim RRow2 As Integer
  4. Dim Colomn2 As Integer
  5.  
  6. DataGrid1.Row = 0
  7. DataGrid1.Col = Colomn2
  8. For Colomn2 = 0 To DataGrid1.Columns.Count - 1
  9. DataGrid1.Col = Colomn2
  10. Debug.Print DataGrid1.Text
  11.  
  12. Next
  13.  
  14. RRow2 = 0
  15. Colomn2 = 0
  16. DataGrid1.Col = Colomn2
  17. DataGrid1.Row = RRow2
  18.  
  19. If MsgBox("           Print to all?", vbOKCancel, "Print") = vbCancel Then
  20. Exit Sub
  21. End If
  22.  
  23. For RRow2 = 0 To rs2.RecordCount - 1
  24.  
  25.         For Colomn2 = 0 To DataGrid1.Columns.Count - 1
  26.             DataGrid1.Col = Colomn2
  27.         Next
  28.         Text2.Text = DataGrid1.Text    'this line got error    
  29.  
  30.         LabelFormat2
  31.  
  32.         rs2.MoveNext        
  33.  Next
  34.         Printer.EndDoc
  35. End Sub
  36.  
Expand|Select|Wrap|Line Numbers
  1. Public Sub LabelFormat2()
  2.  
  3. Printer.Print "{D0391,0919,0360|}"
  4. Printer.Print "{C|}"
  5. Printer.Print "{D0391,0919,0360|}"
  6. Printer.Print "{AX;+000,+000,+00|}"
  7. Printer.Print "{AY;+00,0|}"
  8. Printer.Print "{PC000;0136,0162,20,25,K,00,B|}"
  9. Printer.Print "{RC00;" & Text2.Text & "|}"
  10. Printer.Print "{XB00;0210,0200,A,3,03,0,0144,+0000000000,000,0,00|}"
  11. Printer.Print "{RB00;>5>8>6" & Text2.Text & "|}"
  12. Printer.Print "{XS;I,0001,0002C6200|}"
  13.  
  14. Printer.EndDoc
  15.  
  16. End Sub
  17.  
Jan 7 '12 #1
6 6156
Rabbit
12,516 Expert Mod 8TB
What line is the error on?
Jan 7 '12 #2
Run time error '6160' data access error

Expand|Select|Wrap|Line Numbers
  1. Text2.Text = DataGrid1.Text    'this line got error    
  2.  
Jan 7 '12 #3
Rabbit
12,516 Expert Mod 8TB
The DataGrid.Text property is not meaningful. It's not supposed to be used for anything.
Jan 7 '12 #4
but how to set value from datagrid1.text to my text1.text?
Jan 7 '12 #5
Rabbit
12,516 Expert Mod 8TB
Datagrid.text has no value. You shouldn't ever want to use it for anything. Why you want to use it perplexes me. You must be trying to do something else and think you need to use datagrid.text but I have no idea what you're trying to do because you haven't said.
Jan 7 '12 #6
Killer42
8,435 Expert 8TB
According to my research, there are a number of ways to access the data in a DataGrid control. One way is via the the .Text property of the DataGrid object which provides the (formatted) value of the current cell. Another is via the .Value property of the Column object. Please review the documentation for the DataGrid control, which will no doubt include samples.

I'd provide pointers to the relevant doco at MSDN, but for some reason trying to look something up there does a search of the entire web instead.

However, the runtime error 6160 is most likely caused by there being no data in the recordset. Try hitting Google for something like "runtime error 6160" and you'll find all sort of info.

Oh, one other thing. Are you aware that your Colomn2 loop doesn't do anything? My guess is that it should include the printing.
Jan 10 '12 #7

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

Similar topics

0
by: Rod | last post by:
I have written an app which uses the ms data control for access 97 (dao350.dll) if installed on windows 2000 the program runs perfectly, but when installed on windows XP I get a "Data Access...
0
by: Mark Lewin | last post by:
Hi all I'm pulling my hair out over this particular problem and I'm wondering whether you clever people can help. I'm running the demo version of Access 2003, which I understand to be a...
2
by: david | last post by:
i am having trouble with accessing the access database using the oledb Jet drivers in the visual studio .net environment. when i try to open the connection i recieve the error message which says...
2
by: Michael | last post by:
Hi Everyone, Please help me on this one. I have the following function: Public Sub SearchFor(ByRef mType As Module1.SearchForType, ByRef mValue As String) On Error GoTo Err_Handler Dim Proc As...
0
by: Nilesh Pathak via .NET 247 | last post by:
(Type your message here) Sir ,I created project in asp.net in ver 7.0 without any problem, but when I used it in ver 7.1 there is a problem in dataaccessing. The error is :...
0
by: Tim | last post by:
I am having the exact same problem as below. Has anyone found the solution for this? I believe the solutions lies somewhere in here:...
0
by: le0 | last post by:
guys, i have this problem when accessing a page in a server, this error always appears --------------------------------------------------------------------------------------------- Server...
1
by: bozzsystems | last post by:
I have build an application that uses data reports in VB 6.0 connecting to Access2000 Database. The most interesting thing is that for the first time in my many years of programming am encountering...
4
by: Rick | last post by:
I've moved code from a stage machine to the production machine, exact same code works fine on the stage machine, they are both windows 2003 servers, I'm getting a "Cannot generate SSPI context"...
1
by: Wernerh | last post by:
Please could someone help with this problem. I have a datagrid that works perfectly back to a MS database. I have written the keycode functions for up, down, left and right keys in the datagrid. A...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.