Display data in a subform
I have two tables:
tCon: tTrans:
ConID TransID
EnvNo EnvNo
Name Money
Desc
Basically its a form(works on tTrans) with a subform(works on tCon) in it and what I need it to do is when I type in a EnvNo, after I lose focus with it I need it to display below, where the subform is the informaiton for that EnvNo account(displays Name and desc). How can I go about display that. Here is what I have but I am not sure how to send the id so that it can be displayed in the subform which is part of my main form.
Private Sub txtEnvNo_LostFocus()
On Error GoTo errhandler
Dim strConId As String
If txtEnvNo.Text <> "" Then
intEnvNo = txtEnvNo.Text
strConId = DLookup("[ConID]", "tCon", "[EnvNo]=" & intEnvNo)
Else
MsgBox "Please input a EnvNo"
End If
Exit Sub
errhandler:
MsgBox "Record does not exist"
End Sub
|