Setting up Subform after Locating data

jcwillette

Registered User.
Local time
Yesterday, 23:03
Joined
Jan 19, 2009
Messages
23
Thanks for all those who helped me out. I still have a couple of problems in my coding for the main and sub forms. Any help would be apprceiated.

Here are my Input Form Fields:

VehicleID AutoNumber
License Text
State Text
Make Text
Model Text
Type Text
Color Text
Code 4 Yes/No Box


These are my Subform Fields;\:

License Text
Informed Yes/No Box
Date Date/Time
Time Date/Time
Reason Text
Checkpoint Text
Level Text
Section Text
Comments Text


I want to be able to search for a license plate and if found, display all the data I have for that record, including all the records I have in the subform and place me at the date field in the subform for a new date entry. :D

Here is the code that I have for the main form:

Private Sub Search_AfterUpdate()

If Not IsNull(Me.Search) Then
' Save before move.
If Me.Dirty Then
Me.Dirty = False
End If

' Find the Licene that matches the Search String.
Dim rs As Object
' License = ""

Set rs = Me.Recordset.Clone
rs.FindFirst "[License] = '" & Me![Search] & "'"



If Not rs.EOF Then Me.Bookmark = rs.Bookmark

If rs.NoMatch Then
DoCmd.OpenForm "InputForm", acNormal
DoCmd.GoToRecord , , acNewRec
MsgBox "License not found in Database!"
License = Search
Me.State.SetFocus
Else

End If

Set rs = Nothing

End If

End Sub

Any help with this is very much appreciated. Thanks;)
 

Users who are viewing this thread

Back
Top Bottom