First record not displaying in subforms.

kvar

Registered User.
Local time
Today, 12:17
Joined
Nov 2, 2009
Messages
77
I have a form with some tabbed subforms. Master/Child links are set, everything is bound.
When I open the form to display records (based on search criteria on the switchboard form), let's say it returns 6 records for someone, they are sorted by date and so the newest would display first.
But when it opens, the main form shows all the appropriate data, but the subforms don't show at all. Just a blank box where the subform control should be. If I click next record (and any thereafter) they all display correctly immediately. Now if I go to the 2nd record, then back to my 1st record, it displays correctly.

I'm guessing it must have something to do with the onLoad event of either the main form or subforms, but I don't have anything in there for OnLoad....no code at all.
Perhaps I need some?
 
Last edited:
Is your sub form too big?

Do you get to see a vertical scroll bar in the sub form. If you do try moving it up and down to see if that makes a difference.

If this is not the case do you have any code behind the sub.
Post all of it if you would.
 
I would think if it were a size issue it still wouldn't display when I go back to that record. But it's not, I have the scroll bars displayed and that all seems to be fine. And when I open the same form to enter a new record (add) it opens just fine, I can see all the subforms immediately.

There is no code behind it at all, they're pretty simple really. The only code that is even related to this form is in the onclick's from 2 buttons on the main form. One to open this form to enter a new record and the other opens it in acReadOnly to view existing records.

It worked fine 2 days ago and I have been racking my brain trying to think of what I could've changed that would cause this, but I'm coming up with nothing. It must be caused by something that just "seems" unrelated but Access has some issue with. I was going to just say forget it and leave it like this, going forward and back is not that big of a deal, but when I search for someone that returns only one record I'm SOL. Can't get it to display if there is nowhere to navigate to and back from.
 
Make a copy first then play with the size of the sub form.

That is the only thing I can think of at the moment.
 
Well it definitely doesn't seem to be size related.
I did some more playing around and sort of made some progress.

In the OnLoad of the main form I added:

Me.Communication.Form.Requery
Me.Community.Form.Requery
Me.Functional.Form.Requery
etc.
Naming each of my subforms, there are nine in all. Then when I opened the records the first subform on the first record displayed as it should (tab that's on top). BUT - when I click on any of the other tabs, they are still just blank, doesn't show the subform at all. Until I navigate forward a record and come back, then they're there again.
I even tried rearranging the order of my "Requeries" thinking maybe only the first listed was showing up, but no, that's not it either.

So I guess this is a step forward, but I think I'd like the rest of my subforms to show up too!
Any other suggestions at all? This is really strange and I feel like I've been trying to resolve it for days, I just know it's going to end up being something silly!
 
I took out all the requeries of the subforms and just used a Me.Requery in the OnLoad of the main form and that seems to have fixed it.

Weird.
 
I took out all the requeries of the subforms and just used a Me.Requery in the OnLoad of the main form and that seems to have fixed it.

Weird.

This is good.

I thought you had no code behind the sub, or is this on the Main Form.

I would like for you to solve the problem as a learning exercise.

I am still of the belief that the sub is too big.

Try this

In the Sub Forms design view, add three Labels and put something in them. One Two and Three would be good.

Place them in the Top Let Corner, Bottom Left Corner and the other in the middle. Save and Close.

Open the Main Form and you should see all three Labels. If you can't see all three at once then the sub is to big.

Get rid of the Me.Requery.

It might be a good idea to do this on a copy rather than the original.


BTW What are you running. Is it Access 2003 on Windows 7. I have had problems with "Focus" but I thought that it had been fixed.
 
Yes, you can see them all. They really aren't that large.
I USED to have no code, now I have a Me.requery in the OnLoad of the main form. That's how I fixed it.
Still don't really know what caused it, but it's fixed anyway.

And just out of curiosity, if it were the case that the form was too big, wouldn't that affect all of the records in the dataset? Not just the first one that pops up? And why would it then display correctly if I go to record #2 then back to record #1? Seems like if a form were mis-sized or too big that it would be all the time, not just for one record for a short period of time. (the period of time being the time it takes to navigate to record 2 then back to 1).
 
The difference could be where the Focus is set to. The first or the last record. Or it could be something completely different.

Your logic is sound so we are both at a loss. Also no one else has jumped in to help which normally happens if someone has the solution. :confused:

If you have the time post a cut down version of your Database. I would love to see what is happening.

If you do decide to post make sure the Database is in Access 2003. I don't use 2007 etc.
 

Users who are viewing this thread

Back
Top Bottom