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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PROBLEMS WITH SUBFORM

Status
Not open for further replies.

SandyH

Programmer
Jun 16, 2000
25
0
0
US
Hello,
I am having a problem with trying to create a subform. What I am trying to do is have a subform listed inside of my current form with different Items that you check off whether you want them included or not. The problem I am having is that when I go to a new form the subform stays the same and there is no way that i can think of to correcspond the form and subform to stay together. I have a huge list of items for the subform that I want copied over each time to the new form but want all the check marks to go back to blank.
This is what I want my subform to look like. I tried to do the Id same as main form ID but the problem with that is the subform goes blank when I switch to the next form and I want everything to still be listed.

Item Included Excluded Neither
Air Balance x
Water Heater x
Sales x

This is for a bidding application. The main form has all the general information (i.e. bidder name, project, description of the bid, price, etc) and the subform has what I want included in the bid price or excluded in the bid price (i.e. item name, included check box, excluded check box, or neither check box)Thats about it for both of them. After all the information is completed then I print out a proposal(report) with all the information to give to the company we are bidding the project to.

I know this must sound confusing because I'm confusing myself, but any help at all would be greatly appreciated.
Thank you,
Sandy
[sig][/sig]
 
For a subform to stay synchronised with a main form, there needs to be at least one field common to both in the underlying tables. Do you have a common field in these tables?

If so, on the Main form check that the subform's LinkChildField and LinkMasterField properties are set to the name of this field. This should ensure that the forms are synchronised so that when you move from record to record on the main form, the subform changes to display information for that record.

Hope this helps

Lightning [sig][/sig]
 
ok. I do have a link field it is the BidID field. I have no problems linking the fields. However when I do and try to have the list of items on the subform show up on my main form they don't because they don't have the common bidID field with any value in the field. I want to be able to see everything without having a value in the field of BidID till I click on the included, excluded, or neither button. Also what I want is to be able for the subform to go back to all blank yes/no fields when I switch to the next form.

Maybe what would work best is if I had them in a combo box then was able to click on a selection of "select all" and all the items would flow onto my subform. Is there a way for that to be possible?

Thank you in advance,
Sandy [sig][/sig]
 
Can you send me a copy of the form & subform that I can look at and play with? Between us we should be able to sort it out.

My e-mail address is

bryan.fitzpatrick@interact.net.au [sig][/sig]
 
What are the relationships between the two tables, this is important as it seems to me that what you need to do is create a one to one relationship between them. Set the properties to cascade update and cascade delete, then you have to write some code that will create the new record in your subform. I did this a while ago, only difference is I used a new form to display the corresponding records. My code looks like this:
Dim StrLinkCriteria As String 'Declare the variable StrLinkCriteria
Dim stDocName As String 'Declare the variable stDocName
stDocName = "Section B" 'Define stDocName

'If there is already a record corresponding to the ApplicantID in Section B
'Open the form with that record
If DLookup("[ApplicantID]", "[Section B]", "[ApplicantID]=" & Forms![SECTION A]![ApplicantID]) Then
'Define StrLinkCriteria, open the form in edit mode and requery the source for the form
StrLinkCriteria = "[ApplicantID] = Forms![Section A]![ApplicantID]"
DoCmd.OpenForm stDocName, , , StrLinkCriteria
DoCmd.Requery
'Otherwise open the form in add mode and set the OpenArgs value to the ApplicantID
Else
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenForm stDocName, , , , acAdd, , Me!ApplicantID

End If

Does this help you?

My e-mail is

m5gaut@mweb.co.za [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top