By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,519 Members | 2,412 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,519 IT Pros & Developers. It's quick & easy.

Form and Subform linked

P: n/a
Can someone help. I'm afraid I'm not too good at Access. What I'm trying to
do is create a main form with a subform. The subform is "Search by Item
Desc", which the record source is a query called "Item Desc". I want to
have 2 fields in the Detail section of the main form.......Item Desc and Part
Number, where you can
enter an item desc or part number, such as "Specials" and have the subform
below show just
the parts and information for all "Specials" . I need to show the info
only for whatever the Item Desc or Part Number might be that is entered into
that field. Can someone explain to me how to do this? I'm not sure how to
link the above fields to the subform to get this to work.

Thanks!

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200612/1

Dec 13 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
In the OnUpdate event of the search field, pass the Source to the
subform. i.e.:

form.subform.source = "Select * from qryItemDesc where PartNumber like
*" & me.PartNumber & "* or ItemDesc like *" & me.ItemDesc & "*")
'Refresh the subform
form.subform.refresh

This will search both fields for anything that includes the text in
your textboxes. The drawback is that if someone searches for "help",
it will bring back records containing "helper". If you don't want that
functionality, change it to:

form.subform.source = "Select * from qryItemDesc where PartNumber = " &
me.PartNumber & " or ItemDesc = " & me.ItemDesc & "")
'Refresh the subform
form.subform.refresh

BTW, it's always a good idea in Access to NOT use spaces in your field
or table names. If you have to, use an underscore ( _ ), or just
remove the space altogether (i.e. "Item Desc" becomes "ItemDesc").
Using spaces calls for additional code and it's not worth the hassle.

Lori2836 via AccessMonster.com wrote:
Can someone help. I'm afraid I'm not too good at Access. What I'm trying to
do is create a main form with a subform. The subform is "Search by Item
Desc", which the record source is a query called "Item Desc". I want to
have 2 fields in the Detail section of the main form.......Item Desc and Part
Number, where you can
enter an item desc or part number, such as "Specials" and have the subform
below show just
the parts and information for all "Specials" . I need to show the info
only for whatever the Item Desc or Part Number might be that is entered into
that field. Can someone explain to me how to do this? I'm not sure how to
link the above fields to the subform to get this to work.

Thanks!

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200612/1
Dec 14 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.