473,378 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Form Subform Problem...

Hi, I have a database with only one table containing the following
fields:

ID (primary key, auto-counter), Client (Text), Internal_ID (Text),
Window (Y/N), Lock(Y/N), LED (Y/N)

What I'm trying to do, with no success, is to build a form with
unbound controls and filter thru the main table with a subform...

Problem is it doesn't work at all... if I get all the fields right,
then I get the only product matching, otherwise... blank...

What I would want to get is to sequentally eliminate the non matching
products: this is exactly what I am trying to accomplish:

Oper form, every product is shown;
If I click any of the Y/N fields, only the records with Y or N in that
field will be shown, regardless of the other fields (I start with Null
in each unbound control...)

OR

If I input a Client, all the products for that client show, regadless
of the content of the other unbound controls/data, if I left them at
"Null" state, of course, then by clicking a Y/N control, all the
products for that client with that single characterist show,
regardless of the others and so on...

I am completely lost. Any suggestions? Thank u in advance for any help
u may provide...

Ciao, Lupo

Sep 8 '07 #1
1 1534
Okay, so you have some unbound controls on a form for entering the criteria,
and you want to then display the matching results in the form (which is
bound to your table.)

The code to do that will need to see which boxes are not null, and build the
filter string from them. This kind of thing:

Dim strWhere As String
Dim lngLen As Long

If Me.Dirty Then Me.Dirty = False 'save first

If Not IsNull(Me.txtClient) Then
strWhere = "(Client Like """ & Me.txtClient & "*"") AND "
End If

If Not IsNull(Me.chkWindow.Value) Then
strWhere = strWhere & "([Window] = " & Me.chkWindow.Value & ") AND "
End If

'etc

lngLen = Len(strWhere) - 5 'without the trailing " AND ".
If lngLen 0 Then
Me.Filter = Left(strWhere, lngLen)
Me.FilterOn = True
Else
MsgBox "Enter some criteria."
End If

For an example of what this might look like, and a downloadable example that
illustrates how to apply the code to different field types, see:
Search form - Handle many optional criteria
at:
http://allenbrowne.com/ser-62.html

--
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.

<lu*****@gmail.comwrote in message
news:11**********************@19g2000hsx.googlegro ups.com...
Hi, I have a database with only one table containing the following
fields:

ID (primary key, auto-counter), Client (Text), Internal_ID (Text),
Window (Y/N), Lock(Y/N), LED (Y/N)

What I'm trying to do, with no success, is to build a form with
unbound controls and filter thru the main table with a subform...

Problem is it doesn't work at all... if I get all the fields right,
then I get the only product matching, otherwise... blank...

What I would want to get is to sequentally eliminate the non matching
products: this is exactly what I am trying to accomplish:

Oper form, every product is shown;
If I click any of the Y/N fields, only the records with Y or N in that
field will be shown, regardless of the other fields (I start with Null
in each unbound control...)

OR

If I input a Client, all the products for that client show, regadless
of the content of the other unbound controls/data, if I left them at
"Null" state, of course, then by clicking a Y/N control, all the
products for that client with that single characterist show,
regardless of the others and so on...

I am completely lost. Any suggestions? Thank u in advance for any help
u may provide...

Ciao, Lupo
Sep 8 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Max Harvey | last post by:
Hi, I made up a nice little form which had its own sub form in it. I made a litle VB code so that when I pressed a button it would move form the form (frmConference) to the subform...
25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
4
by: Dave Boyd | last post by:
Hi, I have two very similar forms each with a subform. The main form gets a few fields from the user and passes this back to a query that the subform is bound to. The requery is done when the...
12
by: swingingming | last post by:
Hi, in the NorthWind sample database, when clicking on the next navigation button on the new order record with nothing on the subform (order details), we got an order with nothing ordered. How can...
2
by: David W. Fenton | last post by:
I think at various times we've all encountered this problem: A subform is on a main form. From the code of the main form we refer to some property of/control on the child form thus: ...
4
by: Regnab | last post by:
I've got a form - "frmLookup" (with a subform) that works very happily on its own. The form has a list box, which when updated requeries the subform to display the appropriate results. The...
4
by: Macbane | last post by:
Hi, I have a 'main' form called frmIssues which has a subform control (named linkIssuesDrug) containing the subform sfrmLink_Issues_Drugs. A control button on the main form opens a pop-up form...
6
NeoPa
by: NeoPa | last post by:
Introduction The first thing to understand about Sub-Forms is that, to add a form onto another form takes a special Subform control. This Subform control acts as a container for the form that you...
3
by: Darin | last post by:
I have a problem I just can't figure out. I have a form with a subform, and the recordsource of the subform has criteria based on some unbound fields in the parent form so that data in the parent...
11
by: mrowe | last post by:
I am using Access 2003. (I am also using ADO in the vast majority of my code. I recently read a post that indicated that ADO is not all that is was initially cracked up to be. In the back of my...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.