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.
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
If [Store_Barcode]![Barcode] = [Personal]![Barcode] Then
This is the line that is highlighted. Any ideas why it is doing this?