Hi have not use Acces for a while, now I'm trying to work on a project.
I took my old code out, but it does not work with Access 2002.
This is an example... what do I need to change to make it compatible with Access 2002
Thanks
--------------------------------
Option Compare Database
Option Explicit
Dim rstSearchColor As Recordset
Dim dbDL As Database
Private Sub Form_Load()
Set dbDL = CurrentDb
End Sub
Private Sub txtColorCode_Exit(Cancel As Integer)
If Not (txtColorCode = "") Then
Set rstSearchColor = dbDL.openrecordset("SELECT [ColorName] FROM [Colors] WHERE [ColorCode] = " + txtColorCode, dbOpenDynaset)
If rstSearchColor.RecordCount = 0 Then
MsgBox "You entered a wrong Color Code. Please try again.", vbOKOnly, "Search Failed"
Else
rstSearchColor.MoveFirst
txtColorName = rstSearchColor![ColorName]
End If
End If
End Sub
I took my old code out, but it does not work with Access 2002.
This is an example... what do I need to change to make it compatible with Access 2002
Thanks
--------------------------------
Option Compare Database
Option Explicit
Dim rstSearchColor As Recordset
Dim dbDL As Database
Private Sub Form_Load()
Set dbDL = CurrentDb
End Sub
Private Sub txtColorCode_Exit(Cancel As Integer)
If Not (txtColorCode = "") Then
Set rstSearchColor = dbDL.openrecordset("SELECT [ColorName] FROM [Colors] WHERE [ColorCode] = " + txtColorCode, dbOpenDynaset)
If rstSearchColor.RecordCount = 0 Then
MsgBox "You entered a wrong Color Code. Please try again.", vbOKOnly, "Search Failed"
Else
rstSearchColor.MoveFirst
txtColorName = rstSearchColor![ColorName]
End If
End If
End Sub