Results 1 to 3 of 3

Thread: Msflexgrid Saving to database problem

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2001
    Location
    USA
    Posts
    160

    Question Msflexgrid Saving to database problem

    I've got a problem with my msflexgrid1 while attempting to save the data
    to the database.

    I get an datatype conversion error...but I can't figure out why. I aslo dont
    understand the big numbers that I get while looking at the msflexgrid1.text
    value.

    HElp!!!!!!!!!!!

    Please offer some thoughts!!


    If I leave my cursor/mouse on that erorr line I get the value for msflexgrid1.text
    which is a hudge number: 11753595471532175421000000000000000000000000000000000000 . . . .

    VB Code:
    1. Private Sub Command4_Click()
    2. 'save button CODE IS BELOW ?>  > >
    3.  
    4. 'declare local variables . .
    5. Dim r As Integer
    6. Dim t As Long
    7.  
    8. myrs.MoveFirst
    9. For r = 1 To MSFlexGrid1.Rows - 1   ' cycle thru the rows
    10. myrs.Edit      ' this opens the recordset record to be opend to be edited
    11. MSFlexGrid1.Row = r
    12. For t = 0 To myrs.Fields.Count                'cycle thru the fields/columns
    13. MSFlexGrid1.Col = t
    14. myrs.Fields(t) = Format$(Val(MSFlexGrid1.Text))             [COLOR=royalblue]Error Here::3421 Data Type Conversion Error[/COLOR]
    15.  
    16. Next t
    17. myrs.Update
    18. myrs.MoveNext
    19. Next r
    20.  
    21. end Sub

  2. #2
    New Member bartleby's Avatar
    Join Date
    Sep 2001
    Location
    Philippines
    Posts
    6
    What are the datatypes of the fields/columns in the database table where you are saving the data?

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2001
    Location
    USA
    Posts
    160

    Question SAVE PROBLEM TO DATABASE USING FLEXGRID

    Ok, still stuck.

    I tried removing those val and format, and now I get an error that says
    the field is unupdateable.
    Field cant be updated. Erorr 3164.

    What does that error mean & how can it be fixed >?


    Thanks for the help.



    VB Code:
    1. visual basic code:
    2.  
    3.  
    4.  Private Sub Command4_Click()
    5.  'save button CODE IS BELOW ?>  > >
    6.  
    7.     'declare local variables . .
    8.       Dim r As Integer
    9.         Dim t As Long
    10.  
    11.   myrs.MoveFirst
    12.     For r = 1 To MSFlexGrid1.Rows - 1   ' cycle thru the rows
    13.    myrs.Edit      ' this opens the recordset record to be opend to be edited
    14.        MSFlexGrid1.Row = r
    15.   For t = 0 To myrs.Fields.Count                'cycle thru the fields/columns
    16.             MSFlexGrid1.Col = t
    17.       myrs.Fields(t) = Format$(MSFlexGrid1.Text) -->> ERROR IS HERE!@
    18.  
    19.         Next t
    20.        myrs.Update
    21.        myrs.MoveNext
    22.      Next r
    23.          End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width