Hi all!
Here's my question:
I have created 1 table (Clients) with 10 fields (ClientID, Name, Adress,
Phone etc...).
Next, there is a form (Clients) that allows me to fill data into the
relevant fields of the table (ClientID, Name, Adress, Phone etc...)
Just below these 10 fields, there are 5 check boxes. They are all
positioned under the text label "Client wished to contact via:" that allows
me to select one or more of the following check boxes "E-mail, Post, Tel,
Fax, Telex".
So far, so good..
The thing I would like to do is to create a form which will act as a search
form. Inside this new form, I want to be able to have the above mentioned 5
check boxes (Under the text label "Please click on the appropriate search
criteria") and to be able to select one, two or all 5 of them. Finally,
pressing the "Search now" button, a report should be generated with the
records-clients that have selected to be contacted via the selected
methods-check boxes.
Can anyone pls tell me which is the easier method to do this due to that I
am new using Access...
Sorry for the long description... Any guidance will be highly appreciated!
Tnx, AlexG
Evi - 26 Apr 2008 11:03 GMT
You might find that the GettingStarted newsgroup will be a good choice for
your questions.
Lets call your report "YourReport" and the unbound checkboxes in your form
Chk1, Chk2, Chk3 etc.
Click Properties, on the Data tab, choose False next to Default Value
Add button to your Form and let the wizard choose to Preview your report
Open the button's code page by going to Properties, Events and clicking next
to On Click.
Just under where it says 'Dim stDocName As String'
insert the following
Dim Crit As String
Dim MyLength As Long
If Me.chk1 = True Then
Crit = Crit & "([E-mail]= TRUE) AND "
End If
If Me.chk2 = True Then
Crit = Crit & "([Post]= TRUE) AND "
End If
If Me.chk3 = True Then
Crit = Crit & "([Tel]= True) AND "
End If
If Me.chk4 = True Then
Crit = Crit & "([Fax]= True) AND "
End If
If Me.chk5 = True Then
Crit = Crit & "([Telex]= True) AND "
End If
MyLength = Len(Crit) - 5
If MyLength <= 0 Then
Crit = ""
Else
Crit = Left(Crit, MyLength)
End If
DoCmd.OpenReport stDocName, acPreview, , Crit
End If
> Hi all!
> Here's my question:
[quoted text clipped - 25 lines]
>
> Tnx, AlexG
AlexG - 27 Apr 2008 00:47 GMT
Evi, tnx a lot for your assistance.
I have already posted the same question in the GettingStarted newsgroup..
Will be more careful next time and sorry for the double post...
Since you have provided me with some guidance, can you help me with the
"End If without block If" error that prompts me regarding the last End If?
DoCmd.OpenReport stDocName, acPreview, , Crit
End If
End Sub
Also, when moving to another record (pressing the new record button that
have created), the checkboxes do not alter their state. They remain as
checked as when I clicked on them in the previous record...
Thank you very much. Pls inform me if I should post this question in the
GettingStarted newsgroup...
Ο χρήστης "Evi" έγγραψε:
> You might find that the GettingStarted newsgroup will be a good choice for
> your questions.
[quoted text clipped - 43 lines]
>
> End If
Evi - 27 Apr 2008 09:07 GMT
Sorry, my bad. Delete that last End If. It was a typo.
Evi
> Evi, tnx a lot for your assistance.
> I have already posted the same question in the GettingStarted newsgroup..
[quoted text clipped - 65 lines]
> >
> > End If