Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 6th, 2012, 05:03 AM
dongtrien dongtrien is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2010
Posts: 70 dongtrien User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 56 m 13 sec
Reputation Power: 3
Add items to LynxGrid not the same type error?

I put the records in a database with access to LynxGrid Type mismatch error, can you see help my code wrong ?

Private Sub Form_Load()
Dim lRow As Integer

'set list columns
With listEntries
.Redraw = False
.AddColumn "ID Code", 50 '0
.AddColumn "Full Name", 150 '1
.AddColumn "Adress", 260 '2
.AddColumn "Telephone", 70 '3

.Redraw = True
.Refresh
End With

strSQL = "SELECT Tabstaff .IDCode, Tabstaff .FullName, Tabstaff .Adress, Tabstaff .Telephone FROM Tabstaff ;"

rsstaff .Open strSQL, DataCustomers, adOpenKeyset, adLockOptimistic
rsstaff .MoveFirst
listEntries.Redraw = False
listEntries.Clear
While Not rsstaff .EOF
With listEntries
lRow = .ItemCount
.AddItem
.CellText(lRow, 0) = rsstaff !IDCode ' This was the type mismatch error, if this line is rem by single quotes, then the next line will error
.CellText(lRow, 1) = rsstaff !Fullname
.CellText(lRow, 2) = rsstaff !Adress
.CellText(lRow, 3) = rsstaff !Telephone
End With
rsstaff .MoveNext
Wend
listEntries.Redraw = True
listEntries.Refresh
rsstaff .Close

End Sub

Reply With Quote
  #2  
Old August 6th, 2012, 06:18 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Jun 2003
Posts: 14,239 Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 15 h 17 m
Reputation Power: 4445
Almost always a type mismatch with database data code is because a field value in your recordset is NULL when you expected the column to have a value.
__________________
======
Doug G
======
It is a truism of American politics that no man who can win an election deserves to. --Trevanian, from the novel Shibumi

Reply With Quote
  #3  
Old August 6th, 2012, 10:22 PM
dongtrien dongtrien is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2010
Posts: 70 dongtrien User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 56 m 13 sec
Reputation Power: 3
Quote:
Originally Posted by Doug G
Almost always a type mismatch with database data code is because a field value in your recordset is NULL when you expected the column to have a value.


I try to lock the bottom line

'.CellText(lRow, 0) = rsstaff !IDCode
'.CellText(lRow, 1) = rsstaff !Fullname
'.CellText(lRow, 2) = rsstaff !Adress
'.CellText(lRow, 3) = rsstaff !Telephone

and assign directly but still above error
.CellText(lRow, 0) = 2355

or
.CellText(lRow, 1) = "Peter Pan"

Reply With Quote
  #4  
Old August 7th, 2012, 02:36 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Jun 2003
Posts: 14,239 Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 15 h 17 m
Reputation Power: 4445
You should be able to inspect the values contained in the recordset with the vb debugger.

Reply With Quote
  #5  
Old August 13th, 2012, 10:45 PM
dongtrien dongtrien is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2010
Posts: 70 dongtrien User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 56 m 13 sec
Reputation Power: 3
Quote:
Originally Posted by Doug G
You should be able to inspect the values contained in the recordset with the vb debugger.


I tested it but could not be

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Add items to LynxGrid not the same type error?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap