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

Text boxes and labels don't appear in details section of forms

Status
Not open for further replies.

sonseph14

Programmer
Mar 23, 2006
16
US
We created a database and attempted to show a number of different text boxes from several different tables in the details section of a form. Everything appears correctly in design view, but when we got to view the form, nothing appears in the detail section of the form. We've been attempting to figure this out for a few days, but have had no luck. Any help would be appreciated. Thanks.
 
A few slighly confused notes.

Say you have a main table, tblTransaction, with fields:
TransactionID - Primary key
<Fields>

And a related table, tblOrderLine :
OrderLineID - Primary key
TransactionID - Foreign key
<Fields>

When these are build into a form, tblTransaction is the record source for the main form and tblOrderLine is the record source for the subform. The Link Child Fields and Link Master Fields for the subform control are TransactionID. The subform would probably only show <Fields>, not the ID fields. In this set-up, Access will automatically add TransactionID to the subform because it is the Link Child Field. Furthermore, once the user clicks in the subreport, the main record is saved and cannot be undone.
 
You say that the main record is saved when you enter the subform the main record is saved. What does this mean. That the record within your tblTransaction is saved?? If that's what you're saying then I don't think that is happening with our database.

As I said in my previous post, we added a button to the main form to save that record. Only after the button is pressed will the entire form, the main form and the subform, work correctly.

That's the reason we're trying to add code to the form to automatically save the record once the forms are loaded.
 
Would it help if I sent you a very small sample that illustrates what I am saying, to see if we are talking about the same thing, or for you to send me a stripped down version of your database? I am using Access 2000, so it would need to be that version or lower. You can mail me at remou_ AT hotmail DOT com, but please post here first if you are doing so.
 
I'm not exactly sure what version we're using in our lab. I know the version I have here is 2003 so that won't help. More than likely that version is 2003 as well. You can send me the file though if you would like, and I can attempt to try it.

My e-mail is son_seph14 AT hotmail.com
 
I received your email and opened the sample database. It seems to do what we want, but the problem with our database is that the TransactionID in the subform is not matching up with the TransactionID in the main form. I see that you don't have the TransactionID field in the subform, but obviously it's still in the table. My question is, what is the control source for the TransactionID in the OrderLine subform? I'm not sure why it wouldn't be given the same value as the TransactionID in the Transaction table, but in our database this value isn't the same.
 
Alright. There's no need to answer the last post. We found a way around the problem with a kluge solution. We ended up storing the value of the TransactionID of the Transaction form in a variable and then just put this value into the TransactionID of the OrderLine subform. I'm still confused as to why the value wasn't already put in there as was the case in your database, but everything on our form is working as we want it to now.

Thank you so much for you help Remou. It has been very appreciated. You've helped us through a whole lot of problems. I'm just sorry it took so long. Once again, thank you.
 
In the example, the subform's Record Source is tblOrderLine and the Record Source for the main form is tblTransaction, rather than queries with a subset of fields. The important thing is the Link Child and Link Master fields. Because the field TransactionID is part of the record source for the subform, and the Link fields are set correctly, Access is automatically completing the TransactionID field. There is no need for coding. I have doubts about your Link Child and Link Master fields. You will also note that I have set a relationship between the two tables in the relationship window.
I think it would be easiest to run through creating a new form using the wizards, that is create an Autoform: Columnar and using the wizard, add a subform, choosing tblOrderline from tables and queries and setting the Link Child and Link Master fields to TransactionID. This should provide a simplified version of your set up. If it works, we should be one step nearer finding the problem.
 
Sorry that it's been awhile since I've replied. I just assumed the problem was solved. Actually the problem was solved our way with code, but I read your last post and noticed the part about the link child/master fields and decided to check them out. It turns out that those were blank for our subform. I'm guessing that something occured because to create the subform we just dragged it onto the main form rather than created it through the wizard. I decided to recreate the entire form from the wizard and this worked, so everything is working fine. It's amazing how one little slip up can cause so many problems.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top