473,499 Members | 1,922 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Type Mismatch Ii

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


Below is my code in my frmApplicantsEntry:


__________________________________________________ _______________
Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Mint As Integer
  3. Dim date1 As Date
  4. Dim date2 As Date
  5. Dim myApplicationRecord As Application
  6. Dim myPersonalInfoRecord As PersonalInfo
  7. Dim EditFlag As Boolean
  8. Dim CourseID As Long
  9. Dim ApplicationID As Long
  10. Dim PersonalInfoID As Long
  11. Dim ActiveSchoolYearFrom As String, ActiveSchoolYearTo As String
  12. Dim ActiveSchoolYearID As Long
  13. 'Dim CourseID As Long
  14.  
  15.  
  16. Private Sub cmdAdd_Click()
  17.  
  18. 'Call Enabledtxt(Me)
  19. Call UnLockedtxt(Me)
  20. Call EnabledCombo(Me)
  21. Call EnabledListBox(Me)
  22. Call cleartxtbox(Me)
  23.  
  24. txtCourseApplied.SetFocus
  25. DTPDateReg.Enabled = True
  26.  
  27.  
  28. txtAge.Locked = True
  29. cmdAdd.Enabled = False
  30. cmdEdit.Enabled = True
  31. cmdSave.Enabled = True
  32. cmdCancel.Enabled = True
  33. cmdCourseDown.Enabled = True
  34.  
  35.  
  36.  
  37. End Sub
  38.  
  39. Private Sub cmdCancel_Click()
  40.  
  41. Call cleartxtbox(Me)
  42.  
  43.  
  44.  
  45.  
  46. End Sub
  47.  
  48. Private Sub cmdCourseDown_Click()
  49. Call DDFrame(fraSearch)
  50.  
  51.  
  52.   lstCourse.ListItems.Clear
  53.  
  54.     Dim rsCourse As New ADODB.Recordset
  55.  
  56.     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)
  57.  
  58. End Sub
  59.  
  60. Private Sub cmdEdit_Click()
  61.  
  62. Call UnLockedtxt(Me)
  63.  
  64. End Sub
  65.  
  66. Private Sub cmdSave_Click()
  67.  
  68.  
  69. 'If DTPDateReg.Value < 1907 Then
  70. '
  71. '        Call MsgBox(" Please input a year not less than 1907", vbOKOnly + vbExclamation + vbApplicationModal + vbDefaultButton1, "ERROR ON ENTRY!")
  72. '       ' txtFrom.SetFocus
  73. '     '   cmdSave.Enabled = False
  74. '      '  cmdCancel.Enabled = False
  75. '
  76. '        Exit Sub
  77. '
  78. '
  79. 'ElseIf DTPDateReg.Value > Format(Now, "mm/dd/yyyy") Then
  80. '
  81. '        Call MsgBox(" Please input a year not greater than the current", vbOKOnly + vbExclamation + vbApplicationModal + vbDefaultButton1, "ERROR ON ENTRY!")
  82. '       ' txtFrom.SetFocus
  83. '       ' cmdSave.Enabled = False
  84. '       ' cmdCancel.Enabled = False
  85. '
  86. '        Exit Sub
  87. '
  88. '
  89. '
  90. 'End If
  91.  
  92.  
  93.  
  94.     Call GetDataForPersonalInfoRecord
  95.     Call GetDataForApplicationRecord
  96.  
  97. '
  98. '        If EditFlag = False Then
  99.             Call ModApplication.AddNew(myPersonalInfoRecord, myApplicationRecord)
  100.            ' Call ModApplication.AddNew(myPersonalInfoRecord)
  101. '        Else
  102. '            Call ModApplication.Update(newApplicationRecord)
  103. '        End If
  104. '
  105. 'Call Init
  106. '
  107. '    CourseID = 0
  108. '
  109.     'PersonalInfoID = 0
  110. '    SchoolYearID = 0
  111.  
  112. End Sub
  113.  
  114. Private Sub Form_Load()
  115.  
  116. Call Init
  117. Call InitCbo
  118. Call currentSY
  119.  
  120. ActiveSchoolYearID = CESDBConn.Execute("SELECT `t_schoolyear`.`SYFrom`,`t_schoolyear`.`SYTo`FROM `t_schoolyear`WHERE (`Active` LIKE '1')")
  121.  
  122.  
  123.  
  124. End Sub
  125.  
  126. Sub GetDataForApplicationRecord()
  127.  
  128.     With myApplicationRecord
  129.  
  130.         .PersonalInfoID = PersonalInfoID
  131.         .DateOfApplication = DTPDateReg.Value
  132.         .SchoolLastAttended = txtSchoolLastAtnd.Text
  133.         .SLAAddress = txtSchoolAddressLastAttend.Text
  134.         .GeneralAverage = txtHSGenAve.Text
  135.         .CourseID = CourseID 'txtCourseApplied.Text
  136.         .SchoolYearID = ActiveSchoolYearID
  137.  
  138.  
  139.      End With
  140.  
  141.  
  142.  
  143.  
  144. End Sub
  145.  
  146.  
  147.  
  148.  
  149. Sub GetDataForPersonalInfoRecord()
  150.  
  151.  
  152. With myPersonalInfoRecord
  153.  
  154.         .FName = txtFName.Text
  155.         .MI = txtMI.Text
  156.         .LName = txtLName.Text
  157.         .BirthDate = txtDateOfBirth.Text
  158.         .PlaceOfBirth = txtPlaceOfBirth.Text
  159.         .Age = txtAge.Text
  160.         .Gender = cboGender.Text
  161.         .HomeAddress = txtHomeAdd.Text
  162.         .ContactPerson = txtContactPerson.Text
  163.         .ContactPersonPhone = txtContactNumber.Text
  164.         .Father = txtFather.Text
  165.         .Mother = txtMother.Text
  166.         .HSDateGraduated = txtHSYearGrad.Text
  167.  
  168.  
  169.  
  170.     End With
  171. End Sub
  172.  
  173. Sub Init()
  174.  
  175. 'Call cleartxtbox(Me)
  176. 'Call Disabledtxt(Me)
  177. Call Lockedtxt(Me)
  178. Call DisabledCombo(Me)
  179. Call DisabledListBox(Me)
  180. Call clearlistbox(Me)
  181.  
  182. DTPDateReg.Value = Now
  183. DTPDateReg.Enabled = False
  184.  
  185.  
  186. cmdEdit.Enabled = False
  187. cmdSave.Enabled = False
  188. cmdCancel.Enabled = False
  189. cmdCourseDown.Enabled = False
  190.  
  191.  
  192.  
  193.  
  194. End Sub
  195.  
  196. Private Sub InitCbo()
  197.  
  198.     cboGender.AddItem "Male"
  199.     cboGender.AddItem "Female"
  200.  
  201. End Sub
  202.  
  203.  
  204. Private Sub lstCourse_Click()
  205. txtCourseApplied = lstCourse.SelectedItem.SubItems(1)
  206. txtMajorCourse = lstCourse.SelectedItem.SubItems(2)
  207. CourseID = lstCourse.SelectedItem.Text
  208.  
  209. fraSearch.Visible = False
  210. End Sub
  211.  
  212. Private Sub textSearchMajor_Change()
  213. Dim rsCourse As New ADODB.Recordset
  214.  
  215.     lstCourse.ListItems.Clear
  216.     Call PopulateList(lstCourse, "SELECT`t_course`.`CourseID`,`t_course`.`CourseName`,`t_major`.`Major`
  217. FROM `t_course`INNER JOIN `t_major` 
  218. ON (`t_major`.`MajorID` = `t_course`.`MajorID`)
  219. WHERE (`Major` LIKE '" & textSearchMajor & "%')", rsCourse)
  220.  
  221.  
  222. End Sub
  223.  
  224. Private Sub txtDateOfBirth_LostFocus()
  225.  
  226.  
  227.  
  228.  
  229. If txtDateOfBirth.Text = "" Then
  230.  
  231.         Call MsgBox("Please Fill up blank fields", vbOKOnly + vbExclamation + vbApplicationModal + vbDefaultButton1, "ERROR ON ENTRY!")
  232. '        cmdSave.Enabled = False
  233. '        cmdCancel.Enabled = False
  234. '        txtFrom.SetFocus
  235.         Exit Sub
  236.  
  237. 'ElseIf txtDateOfBirth.Text > Format(Now, "MM/dd/yyyy") Then
  238. '
  239. '        Call MsgBox("Please Fill up correct birthday", vbOKOnly + vbExclamation + vbApplicationModal + vbDefaultButton1, "ERROR ON ENTRY!")
  240. '        '  cmdSave.Enabled = False
  241. '        '    cmdCancel.Enabled = False
  242. '        '    txtFrom.SetFocus
  243. '        Exit Sub
  244. '
  245. 'ElseIf txtDateOfBirth.Text < 10 Then
  246. '
  247. '        Call MsgBox("Please Fill up right date format", vbOKOnly + vbExclamation + vbApplicationModal + vbDefaultButton1, "ERROR ON ENTRY!")
  248. ''        cmdSave.Enabled = False
  249. ''        cmdCancel.Enabled = False
  250. ''        txtFrom.SetFocus
  251. '        Exit Sub
  252. '
  253. '
  254. End If
  255. date1 = Format(Now, "MM/dd/yyyy")
  256. date2 = txtDateOfBirth.Text    '#6/2/1988#
  257.  
  258. Mint = DateDiff("yyyy", date2, date1)
  259. txtAge.Text = "" & Mint
  260. Mint = DateDiff("yyyy", date2, date1)
  261. End Sub
  262.  
  263. Private Sub txtSearch_Change()
  264.  
  265. Dim rsCourse As New ADODB.Recordset
  266.  
  267.     lstCourse.ListItems.Clear
  268.     Call PopulateList(lstCourse, "SELECT`t_course`.`CourseID`,`t_course`.`CourseName`,`t_major`.`Major`
  269. FROM `t_course`INNER JOIN `t_major` 
  270. ON (`t_major`.`MajorID` = `t_course`.`MajorID`)
  271. WHERE (`CourseName` LIKE '" & txtSearch.Text & "%')", rsCourse)
  272.  
  273.  
  274. End Sub
  275.  
  276.  
  277.  
  278.  
  279. 'Sub checkdateReg()
  280. '
  281. 'If DTPDateReg.Value < 1907 Then
  282. '
  283. '        Call MsgBox(" Please input a year not less than 1907", vbOKOnly + vbExclamation + vbApplicationModal + vbDefaultButton1, "ERROR ON ENTRY!")
  284. '       ' txtFrom.SetFocus
  285. '     '   cmdSave.Enabled = False
  286. '      '  cmdCancel.Enabled = False
  287. '
  288. '        Exit Sub
  289. '
  290. '
  291. 'ElseIf DTPDateReg.Value > Format(Now, "mm/dd/yyyy") Then
  292. '
  293. '        Call MsgBox(" Please input a year not greater than the current", vbOKOnly + vbExclamation + vbApplicationModal + vbDefaultButton1, "ERROR ON ENTRY!")
  294. '       ' txtFrom.SetFocus
  295. '       ' cmdSave.Enabled = False
  296. '       ' cmdCancel.Enabled = False
  297. '
  298. '        Exit Sub
  299. '
  300. '
  301. '
  302. 'End If
  303. '
  304. '
  305. '
  306. '
  307. 'End Sub
  308.  
  309. Sub currentSY()
  310.  
  311. ActiveSchoolYearFrom = CESDBConn.Execute("SELECT `t_schoolyear`.`SYFrom`,`t_schoolyear`.`Active`FROM `t_schoolyear`WHERE (`Active` = '1')").Fields("SYFrom")
  312. ActiveSchoolYearTo = CESDBConn.Execute("SELECT `t_schoolyear`.`SYTo`,`t_schoolyear`.`Active`FROM `t_schoolyear`WHERE (`Active` = '1')").Fields("SYTo")
  313.  
  314. lblCurrentSy.Caption = ActiveSchoolYearFrom & " - " & ActiveSchoolYearTo
  315.  
  316. End Sub
  317.  
  318.  
  319.  
  320. here : ModApplication codes
  321.  
  322. _______________________________________________________________-
  323.  
  324.  
  325. Public Type Application
  326.  
  327.  
  328. '******************************** Application ************************************
  329.  
  330. PersonalInfoID As Long
  331. DateOfApplication As String
  332. SchoolLastAttended As String
  333. SLAAddress As String
  334. GeneralAverage  As Long
  335. CourseID   As Long
  336. SchoolYearID  As String
  337.  
  338. End Type
  339.  
  340.  
  341. Public Type PersonalInfo
  342.  
  343. '******************************** Personal Info ************************************
  344.  
  345. FName As String
  346. MI As String
  347. LName As String
  348. BirthDate As String
  349. PlaceOfBirth As String
  350. Age As Integer
  351. Gender As String
  352. HomeAddress As String
  353. ContactPerson As String
  354. ContactPersonPhone As Long
  355. Father As String
  356. Mother As String
  357. HSDateGraduated As String
  358.  
  359. End Type
  360.  
  361.  
  362.  
  363.  
  364.  
  365. Sub AddNew(myPersonalInfoRecord As PersonalInfo, myApplicationRecord As Application)
  366.  
  367.  
  368.  
  369.     With myPersonalInfoRecord
  370.  
  371.  
  372.         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_personalinfo`.`ContactPersonPhone`,`t_personalinfo`.`Father`,`t_personalinfo`.`Mother`,`t_personalinfo`.`HSDateGraduated`
  373. FROM `t_personalinfo`WHERE (`FName` LIKE '" & .FName & "') 
  374. AND (`MI` LIKE '" & .MI & "') 
  375. AND (`LName` LIKE '" & .LName & "') 
  376. AND (`BirthDate` LIKE '" & .BirthDate & "') 
  377. AND (`PlaceOfBirth` LIKE '" & .PlaceOfBirth & "') 
  378. AND (`Age` LIKE '" & .Age & "') 
  379. AND (`Gender` LIKE '" & .Gender & "') 
  380. AND (`ContactPerson` LIKE '" & .ContactPerson & "') 
  381. AND (`ContactPersonPhone` LIKE '" & .ContactPersonPhone & "') 
  382. AND (`Father` LIKE '" & .Father & "') AND (`Mother` LIKE '" & .Mother & "') 
  383. AND (`HSDateGraduated` LIKE '" & .HSDateGraduated & "')").EOF Then
  384.  
  385.                 CESDBConn.Execute "INSERT INTO `t_personalinfo` (`FName`, `MI`, `LName`, `BirthDate`, `PlaceOfBirth`, `Age`, `Gender`, `HomeAddress`, `ContactPerson`, `ContactPersonPhone`, `Father`, `Mother`, `HSDateGraduated`)" & _
  386.                                " VALUES('" & .FName & "', '" & .MI & "', '" & .LName & "', '" & .BirthDate & "', '" & .PlaceOfBirth & "', '" & .Age & "', '" & .Gender & "', '" & .HomeAddress & "', '" & .ContactPerson & "', '" & .ContactPersonPhone & "', '" & .Father & "', '" & .Mother & "', '" & .HSDateGraduated & "')" '
  387.  
  388.     End If
  389.  
  390.  
  391.  
  392.  
  393.     End With
  394.  
  395.     With myApplicationRecord
  396.  
  397.         If CESDBConn.Execute("SELECT `t_application`.`PersonalInfoID`,`t_application`.`DateOfApplication`,`t_application`.`SchoolLastAttended`,`t_application`.`SLAAddress`,`t_application`.`GeneralAverage`,`t_application`.`CourseID`,`t_application`.`SchoolYearID`
  398. FROM `t_application`
  399. WHERE (`t_application`.`PersonalInfoID` LIKE '" & .PersonalInfoID & "') 
  400. AND (`DateOfApplication` LIKE '" & .DateOfApplication & "') 
  401. AND (`SchoolLastAttended` LIKE '" & .SchoolLastAttended & "') 
  402. AND (`SLAAddress` LIKE '" & .SLAAddress & "') 
  403. AND (`GeneralAverage` LIKE '" & .GeneralAverage & "') 
  404. AND (`CourseID` LIKE '" & .CourseID & "') 
  405. AND (`SchoolYearID` LIKE '" & .SchoolYearID & "') ").EOF Then
  406.  
  407.                  CESDBConn.Execute " INSERT INTO `t_application` (`PersonalInfoID`, `DateOfApplication`, `SchoolLastAttended`, `SLAAddress`, `GeneralAverage`, `CourseID`, `SchoolYearID`)" & _
  408.                                  "VALUES ('" & .PersonalInfoID & "', '" & .DateOfApplication & "', '" & .SchoolLastAttended & "', '" & .SLAAddress & "', '" & .GeneralAverage & "','" & .CourseID & "','" & .SchoolYearID & "')"
  409.  
  410.         End If
  411.  
  412.  
  413.     End With
  414.  
  415.  
  416.  
  417. End Sub
  418.  
  419.  


__________________________________________________ _____________


Please help ,thanks you so much...God bless
Nov 13 '08 #1
1 1744
Dököll
2,364 Recognized Expert Top Contributor
Hey there Friend!

Try not to double post, okay... I believe you posted something on this already:-)

Hope the pevious is resolved!

Dököll
Jan 1 '09 #2

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

Similar topics

5
4423
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
2472
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
2250
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
15780
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
11939
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
2891
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
2783
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
5970
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
2821
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
21522
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
7131
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
7174
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
7388
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4600
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3099
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
297
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.