473,396 Members | 2,052 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Type Mismatch

nurikoAnna
I am having troubled debugging with my codes...It always gets an error "TYPE MISMATCH"


Below is my code in my frmApplicantsEntry:


__________________________________________________ _______________Private Mint As Integer
Dim date1 As Date
Dim date2 As Date
Dim myApplicationRecord As Application
Dim myPersonalInfoRecord As PersonalInfo
Dim EditFlag As Boolean
Dim CourseID As Long
Dim ApplicationID As Long
Dim PersonalInfoID As Long
Dim ActiveSchoolYearFrom As String, ActiveSchoolYearTo As String
Dim ActiveSchoolYearID As Long
'Dim CourseID As Long


Private Sub cmdAdd_Click()

'Call Enabledtxt(Me)
Call UnLockedtxt(Me)
Call EnabledCombo(Me)
Call EnabledListBox(Me)
Call cleartxtbox(Me)

txtCourseApplied.SetFocus
DTPDateReg.Enabled = True


txtAge.Locked = True
cmdAdd.Enabled = False
cmdEdit.Enabled = True
cmdSave.Enabled = True
cmdCancel.Enabled = True
cmdCourseDown.Enabled = True



End Sub

Private Sub cmdCancel_Click()

Call cleartxtbox(Me)




End Sub

Private Sub cmdCourseDown_Click()
Call DDFrame(fraSearch)


lstCourse.ListItems.Clear

Dim rsCourse As New ADODB.Recordset

Call PopulateList(lstCourse, "SELECT`t_course`.`CourseID`,`t_course`.`CourseNam e `,`t_major`.`Major`FROM `t_course`INNER JOIN `t_major` ON (`t_major`.`MajorID` = `t_course`.`MajorID`)", rsCourse)

End Sub

Private Sub cmdEdit_Click()

Call UnLockedtxt(Me)

End Sub

Private Sub cmdSave_Click()


'If DTPDateReg.Value < 1907 Then
'
' Call MsgBox(" Please input a year not less than 1907", vbOKOnly + vbExclamation + vbApplicationModal + vbDefaultButton1, "ERROR ON ENTRY!")
' ' txtFrom.SetFocus
' ' cmdSave.Enabled = False
' ' cmdCancel.Enabled = False
'
' Exit Sub
'
'
'ElseIf DTPDateReg.Value > Format(Now, "mm/dd/yyyy") Then
'
' Call MsgBox(" Please input a year not greater than the current", vbOKOnly + vbExclamation + vbApplicationModal + vbDefaultButton1, "ERROR ON ENTRY!")
' ' txtFrom.SetFocus
' ' cmdSave.Enabled = False
' ' cmdCancel.Enabled = False
'
' Exit Sub
'
'
'
'End If



Call GetDataForPersonalInfoRecord
Call GetDataForApplicationRecord

'
' If EditFlag = False Then
Call ModApplication.AddNew(myPersonalInfoRecord, myApplicationRecord)
' Call ModApplication.AddNew(myPersonalInfoRecord)
' Else
' Call ModApplication.Update(newApplicationRecord)
' End If
'
'Call Init
'
' CourseID = 0
'
'PersonalInfoID = 0
' SchoolYearID = 0

End Sub

Private Sub Form_Load()

Call Init
Call InitCbo
Call currentSY

ActiveSchoolYearID = CESDBConn.Execute("SELECT `t_schoolyear`.`SYFrom`,`t_schoolyear`.`SYTo`FROM `t_schoolyear`WHERE (`Active` LIKE '1')")



End Sub

Sub GetDataForApplicationRecord()

With myApplicationRecord

.PersonalInfoID = PersonalInfoID
.DateOfApplication = DTPDateReg.Value
.SchoolLastAttended = txtSchoolLastAtnd.Text
.SLAAddress = txtSchoolAddressLastAttend.Text
.GeneralAverage = txtHSGenAve.Text
.CourseID = CourseID 'txtCourseApplied.Text
.SchoolYearID = ActiveSchoolYearID


End With




End Sub




Sub GetDataForPersonalInfoRecord()


With myPersonalInfoRecord

.FName = txtFName.Text
.MI = txtMI.Text
.LName = txtLName.Text
.BirthDate = txtDateOfBirth.Text
.PlaceOfBirth = txtPlaceOfBirth.Text
.Age = txtAge.Text
.Gender = cboGender.Text
.HomeAddress = txtHomeAdd.Text
.ContactPerson = txtContactPerson.Text
.ContactPersonPhone = txtContactNumber.Text
.Father = txtFather.Text
.Mother = txtMother.Text
.HSDateGraduated = txtHSYearGrad.Text



End With
End Sub

Sub Init()

'Call cleartxtbox(Me)
'Call Disabledtxt(Me)
Call Lockedtxt(Me)
Call DisabledCombo(Me)
Call DisabledListBox(Me)
Call clearlistbox(Me)

DTPDateReg.Value = Now
DTPDateReg.Enabled = False


cmdEdit.Enabled = False
cmdSave.Enabled = False
cmdCancel.Enabled = False
cmdCourseDown.Enabled = False




End Sub

Private Sub InitCbo()

cboGender.AddItem "Male"
cboGender.AddItem "Female"

End Sub


Private Sub lstCourse_Click()
txtCourseApplied = lstCourse.SelectedItem.SubItems(1)
txtMajorCourse = lstCourse.SelectedItem.SubItems(2)
CourseID = lstCourse.SelectedItem.Text

fraSearch.Visible = False
End Sub

Private Sub textSearchMajor_Change()
Dim rsCourse As New ADODB.Recordset

lstCourse.ListItems.Clear
Call PopulateList(lstCourse, "SELECT`t_course`.`CourseID`,`t_course`.`CourseNam e `,`t_major`.`Major`FROM `t_course`INNER JOIN `t_major` ON (`t_major`.`MajorID` = `t_course`.`MajorID`)WHERE (`Major` LIKE '" & textSearchMajor & "%')", rsCourse)


End Sub

Private Sub txtDateOfBirth_LostFocus()




If txtDateOfBirth.Text = "" Then

Call MsgBox("Please Fill up blank fields", vbOKOnly + vbExclamation + vbApplicationModal + vbDefaultButton1, "ERROR ON ENTRY!")
' cmdSave.Enabled = False
' cmdCancel.Enabled = False
' txtFrom.SetFocus
Exit Sub

'ElseIf txtDateOfBirth.Text > Format(Now, "MM/dd/yyyy") Then
'
' Call MsgBox("Please Fill up correct birthday", vbOKOnly + vbExclamation + vbApplicationModal + vbDefaultButton1, "ERROR ON ENTRY!")
' ' cmdSave.Enabled = False
' ' cmdCancel.Enabled = False
' ' txtFrom.SetFocus
' Exit Sub
'
'ElseIf txtDateOfBirth.Text < 10 Then
'
' Call MsgBox("Please Fill up right date format", vbOKOnly + vbExclamation + vbApplicationModal + vbDefaultButton1, "ERROR ON ENTRY!")
'' cmdSave.Enabled = False
'' cmdCancel.Enabled = False
'' txtFrom.SetFocus
' Exit Sub
'
'
End If
date1 = Format(Now, "MM/dd/yyyy")
date2 = txtDateOfBirth.Text '#6/2/1988#

Mint = DateDiff("yyyy", date2, date1)
txtAge.Text = "" & Mint
Mint = DateDiff("yyyy", date2, date1)
End Sub

Private Sub txtSearch_Change()

Dim rsCourse As New ADODB.Recordset

lstCourse.ListItems.Clear
Call PopulateList(lstCourse, "SELECT`t_course`.`CourseID`,`t_course`.`CourseNam e `,`t_major`.`Major`FROM `t_course`INNER JOIN `t_major` ON (`t_major`.`MajorID` = `t_course`.`MajorID`)WHERE (`CourseName` LIKE '" & txtSearch.Text & "%')", rsCourse)


End Sub




'Sub checkdateReg()
'
'If DTPDateReg.Value < 1907 Then
'
' Call MsgBox(" Please input a year not less than 1907", vbOKOnly + vbExclamation + vbApplicationModal + vbDefaultButton1, "ERROR ON ENTRY!")
' ' txtFrom.SetFocus
' ' cmdSave.Enabled = False
' ' cmdCancel.Enabled = False
'
' Exit Sub
'
'
'ElseIf DTPDateReg.Value > Format(Now, "mm/dd/yyyy") Then
'
' Call MsgBox(" Please input a year not greater than the current", vbOKOnly + vbExclamation + vbApplicationModal + vbDefaultButton1, "ERROR ON ENTRY!")
' ' txtFrom.SetFocus
' ' cmdSave.Enabled = False
' ' cmdCancel.Enabled = False
'
' Exit Sub
'
'
'
'End If
'
'
'
'
'End Sub

Sub currentSY()

ActiveSchoolYearFrom = CESDBConn.Execute("SELECT `t_schoolyear`.`SYFrom`,`t_schoolyear`.`Active`FRO M `t_schoolyear`WHERE (`Active` = '1')").Fields("SYFrom")
ActiveSchoolYearTo = CESDBConn.Execute("SELECT `t_schoolyear`.`SYTo`,`t_schoolyear`.`Active`FROM `t_schoolyear`WHERE (`Active` = '1')").Fields("SYTo")

lblCurrentSy.Caption = ActiveSchoolYearFrom & " - " & ActiveSchoolYearTo

End Sub



here : ModApplication codes

__________________________________________________ _____________-


Public Type Application


'******************************** Application ************************************

PersonalInfoID As Long
DateOfApplication As String
SchoolLastAttended As String
SLAAddress As String
GeneralAverage As Long
CourseID As Long
SchoolYearID As String

End Type


Public Type PersonalInfo

'******************************** Personal Info ************************************

FName As String
MI As String
LName As String
BirthDate As String
PlaceOfBirth As String
Age As Integer
Gender As String
HomeAddress As String
ContactPerson As String
ContactPersonPhone As Long
Father As String
Mother As String
HSDateGraduated As String

End Type





Sub AddNew(myPersonalInfoRecord As PersonalInfo, myApplicationRecord As Application)



With myPersonalInfoRecord


If CESDBConn.Execute("SELECT `t_personalinfo`.`FName`,`t_personalinfo`.`MI`,`t_ personalinfo`.`LName`,`t_personalinfo`.`BirthDate` ,`t_personalinfo`.`PlaceOfBirth`,`t_personalinfo`. `Age`,`t_personalinfo`.`Gender`,`t_personalinfo`.` HomeAddress`,`t_personalinfo`.`ContactPerson`,`t_p ersonalinfo`.`ContactPersonPhone`,`t_personalinfo` .`Father`,`t_personalinfo`.`Mother`,`t_personalinf o`.`HSDateGraduated`FROM `t_personalinfo`WHERE (`FName` LIKE '" & .FName & "') AND (`MI` LIKE '" & .MI & "') AND (`LName` LIKE '" & .LName & "') AND (`BirthDate` LIKE '" & .BirthDate & "') AND (`PlaceOfBirth` LIKE '" & .PlaceOfBirth & "') AND (`Age` LIKE '" & .Age & "') AND (`Gender` LIKE '" & .Gender & "') AND (`ContactPerson` LIKE '" & .ContactPerson & "') AND (`ContactPersonPhone` LIKE '" & .ContactPersonPhone & "') AND (`Father` LIKE '" & .Father & "') AND (`Mother` LIKE '" & .Mother & "') AND (`HSDateGraduated` LIKE '" & .HSDateGraduated & "')").EOF Then

CESDBConn.Execute "INSERT INTO `t_personalinfo` (`FName`, `MI`, `LName`, `BirthDate`, `PlaceOfBirth`, `Age`, `Gender`, `HomeAddress`, `ContactPerson`, `ContactPersonPhone`, `Father`, `Mother`, `HSDateGraduated`)" & _
" VALUES('" & .FName & "', '" & .MI & "', '" & .LName & "', '" & .BirthDate & "', '" & .PlaceOfBirth & "', '" & .Age & "', '" & .Gender & "', '" & .HomeAddress & "', '" & .ContactPerson & "', '" & .ContactPersonPhone & "', '" & .Father & "', '" & .Mother & "', '" & .HSDateGraduated & "')" '

End If




End With

With myApplicationRecord

If CESDBConn.Execute("SELECT `t_application`.`PersonalInfoID`,`t_application`.` DateOfApplication`,`t_application`.`SchoolLastAtte nded`,`t_application`.`SLAAddress`,`t_application` .`GeneralAverage`,`t_application`.`CourseID`,`t_ap plication`.`SchoolYearID`FROM `t_application`WHERE (`t_application`.`PersonalInfoID` LIKE '" & .PersonalInfoID & "') AND (`DateOfApplication` LIKE '" & .DateOfApplication & "') AND (`SchoolLastAttended` LIKE '" & .SchoolLastAttended & "') AND (`SLAAddress` LIKE '" & .SLAAddress & "') AND (`GeneralAverage` LIKE '" & .GeneralAverage & "') AND (`CourseID` LIKE '" & .CourseID & "') AND (`SchoolYearID` LIKE '" & .SchoolYearID & "') ").EOF Then

CESDBConn.Execute " INSERT INTO `t_application` (`PersonalInfoID`, `DateOfApplication`, `SchoolLastAttended`, `SLAAddress`, `GeneralAverage`, `CourseID`, `SchoolYearID`)" & _
"VALUES ('" & .PersonalInfoID & "', '" & .DateOfApplication & "', '" & .SchoolLastAttended & "', '" & .SLAAddress & "', '" & .GeneralAverage & "','" & .CourseID & "','" & .SchoolYearID & "')"

End If


End With



End Sub





__________________________________________________ _____________


Please help ,thanks you so much...God bless
Nov 14 '08 #1
1 1573
QVeen72
1,445 Expert 1GB
Hi,

Can you Highlight the part where you are getting Error....?

Regards
Veena
Nov 15 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Arun Wadhawan | last post by:
Hello MY SQL Server is causing me this problem : Microsoft VBScript runtime error '800a000d' Type mismatch: 'ident' >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> I am getting from...
1
by: LJgrnl | last post by:
I've got a type mismatch error that's driving me nutty. Variable blnNoData has the initial value False. If a recordset comes back empty (both .EOF and ..BOF are true) then blnNoData is set to...
1
by: Mark | last post by:
Hi - I tried this in VS.Net, and also in the Web Matrix code below: - but I am getting a type mismatch error. The sql statement runs perfectly from within the Access Query Designer. Can anyone...
7
by: middletree | last post by:
I've been messing with this for hours, and have been to various sites, including Aaron's site, and am truly stumped. The short version: in SQL Server, the 4 fields in question are datetime. I...
4
by: Mike | last post by:
I am getting a type mismatch error when I do a bulk insert. ---Begin Error Msg--- Server: Msg 4864, Level 16, State 1, Line 1 Bulk insert data conversion error (type mismatch) for row 1, column...
3
by: amitbadgi | last post by:
I am getting teh following error while converting an asp application to asp.net, Exception Details: System.Runtime.InteropServices.COMException: Type mismatch. Source Error: Line...
1
by: Brett | last post by:
I have a form that calls a method within a DLL. By clicking a button on the form, the DLL is instantiated and the SaveOutlookMessage() method invoked. The DLL code copies messages from Outlook to...
6
by: Howard Kaikow | last post by:
I'm doing a VB 6 project in which I am trying to protect against type mismatch errors. Is the process any different in VB .NET? Here's what I'm doing in VB 6. I have an ActiveX DLL. The...
5
by: kjworm | last post by:
Hello Everyone, I have been fighting with a type mismatch error for many hours today and I can't seem to find what the problem is. Hopefully it is more than a missing apostrophe! I have isolated...
19
by: Lysander | last post by:
I have written a query that takes three integers representing day,month and year, forms a date from them and compares this date to the date the record was entered and returns any records where the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.