Type Mismatch  | Newbie | | Join Date: Nov 2008
Posts: 26
| |
Hi Gooday!!!
When I click my save button for saving I always got this error "Type Mismatch "
I don't know why....
Here is my codes -
Dim newSectionRecord As SectionRecord
-
Dim EditFlag As Boolean
-
Dim CourseID As Long
-
Dim YearLevelID As Long
-
Dim FacultyID As Long
-
Dim SectionID As Long
-
-
Private Sub cmdAdviser_Click()
-
-
Call DDFrame(fraAdvisers)
-
-
lstAdvisers.ListItems.Clear
-
-
Dim rsAdvisers As New ADODB.Recordset
-
-
Call PopulateList(lstAdvisers, "SELECT `t_faculty`.`FacultyID`,`t_faculty`.`FacultyFName`,`t_faculty`.`FacultyMI`,`t_faculty`.`FacultyLName`,`t_faculty`.`DepartmentID`FROM `t_faculty`", rsAdvisers)
-
-
-
End Sub
-
-
Private Sub cmdMajor_Click()
-
Call DDFrame(fraSearch)
-
-
lstCourse.ListItems.Clear
-
-
Dim rsCourse As New ADODB.Recordset
-
-
'Call PopulateList(lstCourse, "SELECT`t_course`.`CourseID`,`t_course`.`CourseName`,`t_major`.`Major`FROM `t_course`INNER JOIN `t_major` ON (`t_major`.`MajorID` = `t_course`.`MajorID`)", rsCourse)
-
Call PopulateList(lstCourse, "SELECT `t_course`.`CourseID`,`t_course`.`CourseName`,`t_major`.`Major`,`t_department`.`Department`FROM `t_course`INNER JOIN `t_department` ON (`t_department`.`DepartmentID` = `t_course`.`DepartmentID`)INNER JOIN `t_major` ON (`t_major`.`MajorID` = `t_course`.`MajorID`)", rsCourse)
-
End Sub
-
-
Private Sub cmdSave_Click()
-
-
txtCaption.Text = txtSectionName.Text & "" & txtYearLevel.Text & "" & txtSec.Text
-
-
Call GetDataForSectionRecord
-
-
' If EditFlag = False Then
-
Call modSection.AddNew(newSectionRecord)
-
' Else
-
' Call modSection.Update(newSectionRecord)
-
' End If
-
-
'Call InitForm
-
-
-
-
SectionID = 0
-
-
-
End Sub
-
-
Private Sub cmdYearLevel_Click()
-
Call DDFrame(fraYearLevel)
-
-
'fraSearch.Width = 3255
-
'fraSearch.Height = 3495
-
'fraSearch.Top = 2280
-
'fraSearch.Left = 240
-
-
lstYearLevel.ListItems.Clear
-
-
Dim rsYearLevel As New ADODB.Recordset
-
Call PopulateList(lstYearLevel, "SELECT `t_year`.`YearID`,`t_year`.`Year`FROM `t_year`", rsYearLevel)
-
-
End Sub
-
-
Private Sub Form_Load()
-
-
Me.Caption = "Section"
-
Call ClearForm(Me)
-
-
End Sub
-
-
-
-
Private Sub lstAdvisers_Click()
-
-
txtAdviser.Text = lstAdvisers.SelectedItem.SubItems(1) & " " & lstAdvisers.SelectedItem.SubItems(2) & " " & lstAdvisers.SelectedItem.SubItems(3)
-
FacultyID = lstAdvisers.SelectedItem.Text
-
fraAdvisers.Visible = False
-
-
End Sub
-
-
Private Sub lstCourse_Click()
-
txtCourse.Text = lstCourse.SelectedItem.SubItems(1) & " - " & lstCourse.SelectedItem.SubItems(2)
-
txtSectionName = lstCourse.SelectedItem.SubItems(1) & " - " & lstCourse.SelectedItem.SubItems(2)
-
txtDepartment.Text = lstCourse.SelectedItem.SubItems(2)
-
CourseID = lstCourse.SelectedItem.Text
-
-
fraSearch.Visible = False
-
End Sub
-
-
-
-
Private Sub lstYearLevel_Click()
-
txtYearLevel = lstYearLevel.SelectedItem.SubItems(1)
-
YearLevelID = lstYearLevel.SelectedItem.Text
-
-
fraYearLevel.Visible = False
-
-
-
End Sub
-
-
Private Sub GetDataForSectionRecord()
-
-
'''''''''''''''''''''''''''''''''''' the Section will be highlighted every time I got an error''''''''''''''''''
-
-
With newSectionRecord
-
-
-
.Section = txtCaption.Text
-
.SectionSize = txtSectionSize.Text
-
.FacultyID = FacultyID
-
.CourseID = txtCourse.Text
-
-
End With
-
-
End Sub
-
-
-
'''' '''''This codes are coded in the module name modSection''''''''''''''''''
-
-
-
-
Public Type SectionRecord
-
-
SectionID As Long
-
Section As Long
-
SectionSize As Long
-
FacultyID As Long
-
CourseID As Long
-
-
-
End Type
-
-
-
Sub AddNew(newSectionRecord As SectionRecord)
-
-
With mySectionRecord
-
' If CESDBConn.Execute("SELECT `t_section`.`Section`,`t_section`.`SectionSize`,`t_section`.`FacultyID`,`t_section`.`CourseID`FROM `t_section`WHERE (`Section` LIKE ' Section') AND (`SectionSize` LIKE 'SectionSize') AND (`FacultyID` LIKE 'FacultyID') AND (`CourseID` LIKE 'CourseID')").EOF Then
-
-
CESDBConn.Execute "INSERT INTO `t_section` (`Section`, `SectionSize`, `FacultyID`, `CourseID`)" & _
-
" VALUES ('" & .Section & "', '" & .SectionSize & "' , '" & .FacultyID & "' ,'" & .CourseID & "')"
-
' Exit Sub
-
' Else
-
Call MsgBox("Record already exist in database.", vbOKOnly + vbExclamation + vbApplicationModal + vbDefaultButton1, "Section")
-
' Exit Sub
-
' End If
-
End With
-
-
-
-
-
End Sub
-
-
please help me......please...>God bless
|  | Moderator | | Join Date: Nov 2006 Location: Upstate NY - US
Posts: 2,267
| | | re: Type Mismatch
Greetings, nurikoAnna!
Are you using Microsoft Access? You could need to add a reference to it, and addtionally, a reference ADO or DAO could be needed. I have seen this before with DAO, and that has fixed it when a reference was added:-)
Hope this helps!
Dököll
|  | Newbie | | Join Date: Nov 2008
Posts: 26
| | | re: Type Mismatch
i am using mysql ....
|  | Site Addict | | Join Date: Nov 2007 Location: Zamboanga City, Philippines
Posts: 857
| | | re: Type Mismatch Type Mismatch
It seems like you are trying to insert an invalid value to your column. For example, inserting char or varchar value to a double or integer type. Check your columns' datatype.
Rey Sean
| Similar Visual Basic 4 / 5 / 6 bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,295 network members.
|