'THE 3 LINES OF BELOW SHOW THE KIND OF MESSAGE I AM GETTING WHEN I TRY TO SEND DATA TO THE DATABASE
' I HAVE LEBELED THE 1, 2, 3
'1. Run-time error'40002'
'2. s1000: [MySQL][ODBC 3.51 Driver][mysqld-5.5.24]Incorect
'3. value: 'Text2' for age at row 1
Option Explicit
Dim cnMySql As New rdoConnection
Dim rdoQry As New rdoQuery
Dim rdoRS As rdoResultset
Dim Text2 As String
Dim age As Integer
Private Sub Form_Load()
cnMySql.CursorDriver = rdUseOdbc
cnMySql.Connect = "uid=root;pwd=moses12;server=localhost;driver={MySQL ODBC 3.51 Driver};database=SRMS;dsn=SRMS;"
End Sub
Private Sub cmdSave_Click()
Text2 = age
If age >= 6 Then
'Text4(1).Text = Text4(1).Text + 1
cnMySql.EstablishConnection
With rdoQry
.Name = "root"
.SQL = "insert into regstudent (n_Student,age,sex,nationality,p_birth,d_birth,religion,f_name,tel,occupation,w_place,F_address,m_name,tel2,occupation2,w_place2,F2_address,prev_school,Location,grade_attained,aggregates,code) values ('Text1','Text2','Text3','Text4','Text5','Text6','Text7','Text8','Text9','Text10','Text11','Text12','Text13','Text14','Text15','Text16','Text17','Text18','Text19','Text20','Text21','Text22')"
'.SQL = "Insert into regstudent (admin,tester,user2,user3,user4) VALUES ('101','202','303','404','505')"
Set .ActiveConnection = cnMySql
'THIS LINE IS HIGHLIGHTED YOLEW
Set rdoRS = .OpenResultset(rdOpenKeyset, rdConcurRowVer)
End With
rdoRS.Close
cnMySql.Close
'End If
End Sub
Run-time error'40002'
Page 1 of 13 Replies - 999 Views - Last Post: 17 August 2012 - 08:09 AM
#1
Run-time error'40002'
Posted 16 August 2012 - 09:04 AM
Replies To: Run-time error'40002'
#2
Re: Run-time error'40002'
Posted 17 August 2012 - 07:33 AM
The first question, is what is the DataType of Age in your database?
#3
Re: Run-time error'40002'
Posted 17 August 2012 - 07:52 AM
#4
Re: Run-time error'40002'
Posted 17 August 2012 - 08:09 AM
Then try writing an integer to it and not a string.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote





|