NEED HELP,(SQL) Displaying data in a form based on selection from combo box

D

Data

Hello Experts,

I need help.

First question: I have a main form (Clients) which allows user to
select from a list of client ID's. A number of textboxes or fields get
filled up. Now one of these textboxes is called Condition or the
condition field. I now press a command buttopn which opens the
orientation form.
In the orientation form, I want to display records based on the text
in the Condition field in the Clients form.

Here is copy of my code(I placed in form_load event of the
orientation form).
I don't know where to put it in the orientation_click event(command
button on clients form) or in the form_load event for the orientation
form.

---------------------------------------------------------------------------------------------------------------------------------
Private sub Form_Load
Dim StrSearch As String

If Forms!Clients.Condition = GPM Then

StrSearch = "SELECT [Orientation Table].[Orientation Session
Number], [Orientation
Table].Date,"
StrSearch = StrSearch + " [Orientation Table].[Attendance Code]"
StrSearch = StrSearch + " FROM [Orientation Table]"
StrSearch = StrSearch + " WHERE ((([Orientation Table].[Orientation
Session
Number])<=2))"

DoCmd.RunSQL StrSearch

End If

End Sub

Also gives me errors:
'Error: Can't find the form clients referred to in microsgoft visual
basic code.
'End if not structured properly

If can suggest some resources or list of books to look at, for
beginning access vba programmers that would be great.

Thanks in advance
 
Top