V
vince
i've created a form for data entey proposes. to validate a
textbox i'd like to check if that value exists in one of my
tables within my database. in the lost_focus event
procedure i've included this code.
Private Sub IG_Client_ID_LostFocus()
SQL = "Select * from IG_DB where IG_Client_ID = "
SQL = SQL & Chr(39) & IG_Client_ID.Text & Chr(39)
Set RS = DB.OpenRecordset(SQL)
If RS.EOF Then
MsgBox "BRC ID does not exist!!!", vbExclamation, Error"
IG_Client_ID.Text = ""
IG_Client_ID.SetFocus
Exit Sub
End If
End Sub
in my main module i have this code.
Option Explicit
Public DB As Database
Public RS As Recordset
Public SQL As String
Sub Main()
Set DB = OpenDatabase("c:\IG_DB.mdb")
End Sub
i've used this code before in a vb application and it's
worked fine after i included some dao or ado components.
i'm getting a not defined type error when i declare my
variable DB as type Database. how can i get it to work in
access or is there a simplier way? thanks in advance.
textbox i'd like to check if that value exists in one of my
tables within my database. in the lost_focus event
procedure i've included this code.
Private Sub IG_Client_ID_LostFocus()
SQL = "Select * from IG_DB where IG_Client_ID = "
SQL = SQL & Chr(39) & IG_Client_ID.Text & Chr(39)
Set RS = DB.OpenRecordset(SQL)
If RS.EOF Then
MsgBox "BRC ID does not exist!!!", vbExclamation, Error"
IG_Client_ID.Text = ""
IG_Client_ID.SetFocus
Exit Sub
End If
End Sub
in my main module i have this code.
Option Explicit
Public DB As Database
Public RS As Recordset
Public SQL As String
Sub Main()
Set DB = OpenDatabase("c:\IG_DB.mdb")
End Sub
i've used this code before in a vb application and it's
worked fine after i included some dao or ado components.
i'm getting a not defined type error when i declare my
variable DB as type Database. how can i get it to work in
access or is there a simplier way? thanks in advance.