| | |
Run time error 13 - type mismatch
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Mar 2008
Posts: 63
Reputation:
Solved Threads: 0
Hi,
Im new to VB. Im just trying to do a simple if statement that will open a specific form based on user input. The database requires me to scan in a barcode from a card. I then want to check if that barcode number is already in the database. to do this i have tried the following code.
I recieve the Run time error 13 - type mismatch
This is the line that is highlighted. Any ideas why it is doing this?
Im new to VB. Im just trying to do a simple if statement that will open a specific form based on user input. The database requires me to scan in a barcode from a card. I then want to check if that barcode number is already in the database. to do this i have tried the following code.
Vb Syntax (Toggle Plain Text)
Private Sub Barcode_AfterUpdate() Dim curDatabase As Object Dim tblStore_Barcode As Object Dim tblPersonal As Object Set curDatabase = CurrentDb Set tblStore_Barcode = curDatabase.TableDefs("Store_Barcode") Set tblPersonal = curDatabase.TableDefs("Personal") If [Store_Barcode]![Barcode] = [Personal]![Barcode] Then DoCmd.OpenForm (Personal_2) Else DoCmd.OpenForm (Personal) End If End Sub
I recieve the Run time error 13 - type mismatch
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
If [Store_Barcode]![Barcode] = [Personal]![Barcode] Then
try to remove the bracket "[]"
or try to look the value if it is DBNull. dbnull is not a string type in which if you will try to use it in comparison of strings it would throw an exception error...
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
If [Store_Barcode]![Barcode] = [Personal]![Barcode] Then
or try to look the value if it is DBNull. dbnull is not a string type in which if you will try to use it in comparison of strings it would throw an exception error...
Last edited by jireh; Jun 17th, 2009 at 11:12 am.
A conclusion is the place where you got tired of thinking. http://www.martin2k.co.uk/forums/index.php?showforum=4
http://www.a1vbcode.com/a1vbcode/vbforums/Forum3-1.aspx
http://www.developerfusion.co.uk/for...orum&ForumID=4
![]() |
Similar Threads
- Run-time error '5' (Windows NT / 2000 / XP)
- DLL run-time error (C++)
- Run-Time Error 424 (Visual Basic 4 / 5 / 6)
- Run-time Error when printing Array Contents. (C)
- "Run time error, do you wish to debug?" (Web Browsers)
- Run-Time Error..? (Windows NT / 2000 / XP)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: pls help me how to disable Ctrl + Esc key vb6
- Next Thread: VB6 and Excel
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





