Re: Selection criteria on parameter forms
- From: "Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx>
- Date: Mon, 17 Mar 2008 09:52:17 +0900
Work with the form first.
The search form is bound to a table/query.
The fields you wish to filter on need to be in that table/query.
Does your table have a field named LkUpCustomers?
You have a combo named CboCustomer on your form.
Is this an unbound combo (nothing in its ControlSource)?
Is its RowSource set up so that its Bound Column contains the data that will match the LkUpCustomers field?
Temporarily comment out the other 2 If ... End If blocks, until you get the first one working. They look right, but once you get one working you can apply the same technique to get the others working.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"amd via AccessMonster.com" <u7775@uwe> wrote in message
news:813ee41036245@xxxxxx
Hi Allen,
And it all looked so straighforward!! (sigh!).
I can't even get the query to run properly, let alone the report. I guess
it's best to start with the query and sort that out before tackling the
report.
However, I'm sure I have missed something simple so will try to explain what
I have done.
I have a 'ParameterForm' with 3 selection fields with the following code in
the 'on click' event of the form's Command Button
Private Sub Command2_Click()
Dim strWhere As String
Dim lngLen As Long
If Not IsNull(Me.CboCustomer) Then
strWhere = strWhere & "([LkUpCustomers] = " & Me.CboCustomer & ") AND
"
End If
If Not IsNull(Me.cboClient) Then
strWhere = strWhere & "([LkUpClients] = " & Me.cboClient & ") AND "
End If
If Not IsNull(Me.cboTown) Then
strWhere = strWhere & "([LkUpTown] = " & Me.cboTown & ") AND "
End If
lngLen = Len(strWhere) - 5
If lngLen <= 0 Then
MsgBox "No criteria", vbInformation, "Nothing to do."
Else
strWhere = Left$(strWhere, lngLen)
Me.Filter = strWhere
Me.FilterOn = True
End If
Me.Visible = False
End Sub
The user enters criteria in the fields in the Parameter Form using a drop-
down combo box where the row source is a table - all 3 comboboxes call data
from separate tables.
I then have a query which I hoped would return the data as input on the form
but as soon as I try to run the query I get a "Enter Parameter" message box
with Forms!ParameterForm!CboCustomer
Can you lead me out of the sticky stuff please?
Regards
Alison
amd wrote:Hi Allen,
I'm working away this week and will not be able to get a chance to try this
out until the weekend but a HUGE THANK YOU - it looks to be exactly what I
have been seeking. I have looked through the coding and I'm fairly certain I
understand the principle and can apply it to my own database.
I will give it my best shot and let you know how I get on.
Thanks a million
Alison
See:[quoted text clipped - 13 lines]
Search form - Handle many optional criteria
Many Thanks
Alison
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200803/1
.
- Follow-Ups:
- Re: Selection criteria on parameter forms
- From: amd via AccessMonster.com
- Re: Selection criteria on parameter forms
- References:
- Selection criteria on parameter forms
- From: amd via AccessMonster.com
- Re: Selection criteria on parameter forms
- From: Allen Browne
- Re: Selection criteria on parameter forms
- From: amd via AccessMonster.com
- Re: Selection criteria on parameter forms
- From: amd via AccessMonster.com
- Selection criteria on parameter forms
- Prev by Date: Re: Not In List, saving data
- Next by Date: Tag Heuer Carrera Watches Replica - TAG Heuer Watches Cheap
- Previous by thread: Re: Selection criteria on parameter forms
- Next by thread: Re: Selection criteria on parameter forms
- Index(es):