Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform Help

Status
Not open for further replies.

dvannoy

MIS
May 4, 2001
2,765
US
I have a form which has 19 line items per form. when shipments come in they have doc#. but there could be more then 19 pieces per line item. so what i did was create a button that adds the letters " CONT 1" etc.. after the doc#..My question is i need to create a sub form that will let me see all the forms related to doc#12345 even if theres 3 docs eg..12345, 12345-cont1, 12345-cont2..

The sub form i created will only show me the linked doc# not the rest...is there a way to include the Like statement on a subform..I really dont use them so Im not that fimilar with them...
also I want to add scroll bars to the subform as well..

Thanks in advance
DVannoy
A+,Network+,CNA
dvannoy@onyxes.com
 
if the like-strings are permanent length create both in the main and the sub form an invisible field that refers to the key field like:
=left(RefField, 5)

(if the length is not permanent modify the function as you exact)

These invisible fields will be the keys; insert these names into the "Link Child Fields" and "Link Master Fields" fields.

ide
 
Hallo,

Another way would be to not link the subform, but every time the main form changes record, set the subforms recordsource to the required values,
Ie. In the main forms OnCurrent event

me!frmSubform.Form.Recordsource="SELECT * FROM records WHERE
docno like '*" & Me!Docno & "*' ORDER BY DocNo"

That should do something...

A better way would be to change the table to give each record both integer docNo and integer ContNo fields, and make them both the Primary key.
If you want to display the name as before then set a text box's control source to:
="Doc" & format$([Docno],"00000") & "-CONT" & [ContNo]

Hope that helps,

- Frink
 
im getting an error when trying the code below...

It deos not like the word "like"

Me!frmSubform.Form.RecordSource = "SELECT * FROM records WHERE"
manifestnu like '*" & Me!sample_manifest & "*' ORDER BY sample_manifest"

Thanks DVannoy
A+,Network+,CNA
dvannoy@onyxes.com
 
Me!frmSubform.Form.RecordSource = "SELECT * FROM records WHERE " _
& "manifestnu like '*" & Me!sample_manifest & "*' ORDER BY sample_manifest;"


Try that Joe Miller
joe.miller@flotech.net
 
i am still getting an error..my subform name is billing...and my main form name is lab..

it tells me it cant find the table or query..I tryed changing a few things and still didnt work..

when doing this code should i still link the child fields etc..?

Thanks DVannoy
A+,Network+,CNA
dvannoy@onyxes.com
 
Sounds like you aren't referencing the subform properly. If the event running this code is on the main form (I assume it is) then you'll need this:

Me!NameOfSubFormOBJECT.Form.RecordSource="SELECT BLAH..."

Go into design view of the main form and check the NAME of the control holding the subform (not the name of the subform) needs to be referenced.

Joe Miller
joe.miller@flotech.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top