[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Wait until a recordset is done loading

Posted on 2004-10-19
20
Medium Priority
?
295 Views
Last Modified: 2006-11-17
Hi !

I have this header form that has a recordsource set on its onload event (a query that may be long to run). I also have a subform that is based on a table and therefore is way faster to run. So the details appears like 3 seconds before the header. I'd like to avoid this this ? Maybe wait until the query of the header is finished ?
How could I proceed ? (code needed as usual...)

Thanks
0
Comment
Question by:rouxjean
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 9
20 Comments
 
LVL 19

Expert Comment

by:david251
ID: 12350414
Try putting your code in the Form_open and then add subform.visible= true in the Form_load, since open occurs before load.

-David251
0
 
LVL 39

Expert Comment

by:stevbe
ID: 12350638
Subforms do in fact load before their parent forms so to follow along with David251 ... this code goes in events for the parent form.

Private Sub Form_Open(Cancel As Integer)
   Me.childInvDetail.Visible = False
End Sub

Private Sub Form_Load()
    Me.childInvDetail.Visible = True
End Sub

Steve
0
 
LVL 39

Expert Comment

by:stevbe
ID: 12350649
childInvDetail is the name of the subform control and not the name of the form that is embedded.

Steve
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 

Author Comment

by:rouxjean
ID: 12350851
So subform would be invisible until header query is done. What I want is all the layout to be displayed on form load and all the data to be filled in at once !!
0
 
LVL 39

Expert Comment

by:stevbe
ID: 12352571
then you will need to bind the controls on the subform in the main form's load event

Private SUb Form_Load()

With Me.childDetail.Form.Controls
    .txtID.ControlSource = "ID"
    .txtFirstName.ControlSource = "FirstName"
... etc.
End With

ENd Sub
0
 

Author Comment

by:rouxjean
ID: 12357408
stevbe: i'm already doing this for both the form & subform...but still, the subform is loaded first because, I think, it is based on a small table rather than a large query for the header....
0
 
LVL 39

Expert Comment

by:stevbe
ID: 12357838
are you doing it in the parent form's load event? Using the load event *should* make sure that the recordset is loaded before you start assigning Control Sources

Steve
0
 

Author Comment

by:rouxjean
ID: 12358125
stevbe: well, i'm doing it in the form load event for the texboxes in the form, and in the subform load event for the textboxes in the subform. Is that the cause, what should I do ?
0
 
LVL 39

Expert Comment

by:stevbe
ID: 12358248
do them all from the Load event of the main form, Access loads subforms before main forms.
0
 

Author Comment

by:rouxjean
ID: 12358293
Nope that's what I was saying, i'll try this !
0
 

Author Comment

by:rouxjean
ID: 12358412
Hum I tried like this :
Me.SubQuoteDetails.Form.Controls.Base_Price
and like this :
Me.SubQuoteDetails.Base_Price
Doesn't find the texboxes (of course I added the controlsource after...) !!!!
SubQuoteDetails is the name of the subform component and Base_Price is the name of the texbox
0
 
LVL 39

Expert Comment

by:stevbe
ID: 12358555
use this code on the main form to make sure you have the correct subform control name ...

Private Sub Form_Load()
    Dim ctl As Control
    For Each ctl In Me.Controls
        If ctl.ControlType = acSubform Then
            MsgBox "this is the name to use: " & ctl.Name
        End If
    Next
End Sub
0
 

Author Comment

by:rouxjean
ID: 12359011
SubQuoteDetails.....
0
 
LVL 39

Expert Comment

by:stevbe
ID: 12359183
Do you mean that Intellisense did not display the controls or do you mean the code does not work?

Steve
0
 

Author Comment

by:rouxjean
ID: 12359243
ctl.Name = SubQuoteDetails, this is what the msgbox displayed.
And this is what I used in those tries :
Me.SubQuoteDetails.Form.Controls.Base_Price.ControlSource
or
Me.SubQuoteDetails.Base_Price.ControlSource
Any idea ?
0
 
LVL 39

Accepted Solution

by:
stevbe earned 2000 total points
ID: 12359411
Me.SubQuoteDetails.Form.Controls("Base_Price").ControlSource
0
 

Author Comment

by:rouxjean
ID: 12359632
That did the job thank you !
0
 

Author Comment

by:rouxjean
ID: 12359679
Damn I can't use a with statement like this ? :
===========================
With Me.SubQuoteDetails.Form.Controls
    ("Qty").Locked = True
    ("Qty").ControlSource = "Qty"
End With
===========================
Is there a way to accomplish this ?
0
 
LVL 39

Expert Comment

by:stevbe
ID: 12360464
you could try ...

===========================
With Me.SubQuoteDetails.Form.Controls
    !Qty.Locked = True
    !Qty.ControlSource = "Qty"
End With
===========================

Steve
0
 

Author Comment

by:rouxjean
ID: 12360917
Nice, thanks again !
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question