User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 427,097 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,333 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums
Views: 359 | Replies: 7 | Solved
Reply
Join Date: May 2008
Posts: 10
Reputation: nanawan is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
nanawan nanawan is offline Offline
Newbie Poster

help! "too many lines continuations" error

  #1  
Jul 17th, 2008
please help me..
i have 40 data to display at msflexgrid. but i cannot do that because it show too many continuations error...
Public Function show_msflex(SQL As String)

MSFlexGrid1.Rows = 1

Set rekod = New ADODB.Recordset

    rekod.ActiveConnection = Con
    rekod.CursorLocation = adUseClient
    rekod.CursorType = adOpenDynamic
    rekod.LockType = adLockOptimistic
    rekod.Source = SQL
    rekod.Open
    If rekod.EOF Then
        MsgBox "Sorry, no record in the database"
    End If

While Not rekod.EOF()
    MSFlexGrid1.AddItem rekod!Name & vbTab & _
    rekod!Gender & vbTab & _
    rekod!Race & vbTab & _
    rekod!Address & vbTab & _
    rekod!Address1 & vbTab & _
    rekod!Ic & vbTab & _
    rekod!passport & vbTab & _
    rekod!DOB & vbTab & _
    rekod!POB & vbTab & _
    rekod!Post & vbTab & _
    rekod!State & vbTab & _
    rekod!Contact & vbTab & _
    rekod!coursecode & vbTab & _
    rekod!Citizen & vbTab & _
    rekod!Class & vbTab & _
    rekod!Sem & vbTab & _
    rekod!Admission & vbTab & _
    rekod!AdmissionDate & vbTab & _
    rekod!Completion & vbTab & _
    rekod!Roll & vbTab & _
    rekod!Intake & vbTab & _
    rekod!How & vbTab & _
    rekod!Sponsor & vbTab & _
    rekod!status & vbTab & _
    rekod!GState
    rekod.MoveNext
Wend

Set rekod = Nothing
End Function
Last edited by Tekmaven : Jul 18th, 2008 at 5:32 am. Reason: Code tags
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2008
Location: Sivakasi, Tamilnadu, India
Posts: 459
Reputation: selvaganapathy is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 79
selvaganapathy's Avatar
selvaganapathy selvaganapathy is offline Offline
Posting Pro in Training

Re: help! "too many lines continuations" error

  #2  
Jul 17th, 2008
Hi, Instead of specifying the field name use field index and a loop.
For Example
  1. Dim sAdd as String
  2. Dim i as Integer
  3. For i = 0 To rekod.Fields.Count - 1
  4. sAdd = rekod.Fields(i) & vbTab
  5. Next
  6.  
  7. MSFlexGrid1.AddItem sAdd

But it cannot be in order unless you specify the Fields order in SQL.
KSG
Reply With Quote  
Join Date: May 2008
Posts: 10
Reputation: nanawan is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
nanawan nanawan is offline Offline
Newbie Poster

Re: help! "too many lines continuations" error

  #3  
Jul 17th, 2008
thanks for the reply. i try your code. but msflexgrid didnt show any data.
Reply With Quote  
Join Date: Nov 2006
Posts: 712
Reputation: QVeen72 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 97
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Master Poster

Re: help! "too many lines continuations" error

  #4  
Jul 18th, 2008
Hi,

Check this :

  1. Dim i As Integer
  2. Dim j As Integer
  3. i = 0
  4. Do While Not rekod.EOF
  5. i= i +1
  6. With MSFlexGrid1
  7. .Rows = i+1
  8. For j = 0 To rekod.Fields.Count-1
  9. .TextMatrix(i , j) =rekod(j) & ""
  10. Next
  11. End With
  12. rekod.MoveNext
  13. Loop

Regards
Veena
Last edited by QVeen72 : Jul 18th, 2008 at 9:16 am.
Reply With Quote  
Join Date: Feb 2008
Location: Sivakasi, Tamilnadu, India
Posts: 459
Reputation: selvaganapathy is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 79
selvaganapathy's Avatar
selvaganapathy selvaganapathy is offline Offline
Posting Pro in Training

Re: help! "too many lines continuations" error

  #5  
Jul 18th, 2008
Yes, Veena gives the correct code.
I give another way that use Recordset.GetRows. It may be faster.

  1. Dim i As Long
  2. Dim j As Long
  3. Dim sC As Variant
  4. Dim iU1 As Long
  5. Dim iU2 As Long
  6. Dim sS As String
  7.  
  8. MSFlexGrid1.Clear
  9. MSFlexGrid1.Cols = adoRS.Fields.Count
  10. MSFlexGrid1.Rows = adoRS.RecordCount + 1
  11.  
  12. sC = adoRS.GetRows
  13.  
  14. iU1 = UBound(sC, 1)
  15. iU2 = UBound(sC, 2) 'No of Records
  16. For j = 0 To iU1
  17. MSFlexGrid1.TextMatrix(0, j) = adoRS.Fields(j).Name
  18. Next
  19.  
  20. For i = 0 To iU2
  21. For j = 0 To iU1
  22. MSFlexGrid1.TextMatrix(i + 1, j) = sC(j, i) & ""
  23. Next
  24. Next
KSG
Reply With Quote  
Join Date: May 2008
Posts: 10
Reputation: nanawan is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
nanawan nanawan is offline Offline
Newbie Poster

Re: help! "too many lines continuations" error

  #6  
Jul 22nd, 2008
i tried your code mr selvaganapathy, but i got an error. "operation is not allowed when the object is closed"
Reply With Quote  
Join Date: Nov 2006
Posts: 712
Reputation: QVeen72 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 97
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Master Poster

Re: help! "too many lines continuations" error

  #7  
Jul 23rd, 2008
Hi,

Selva asuumes that your Recordset object name is "adoRS" and it it is opened.. if it is not, then change the variable name to your variable name of the recordset

Regards
Veena
Reply With Quote  
Join Date: May 2008
Posts: 10
Reputation: nanawan is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
nanawan nanawan is offline Offline
Newbie Poster

Re: help! "too many lines continuations" error

  #8  
Jul 23rd, 2008
thanks for all coz helping me so much
i have solved my prob
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Visual Basic 4 / 5 / 6 Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the Visual Basic 4 / 5 / 6 Forum

All times are GMT -4. The time now is 5:31 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC