I've got a form with 2 subforms in it. The fact that there 2 subforms isn't really the problem, its moreso the fact that the form does not display any data (doesn't initiate ON LOAD) until you CLICK IN it. It litterally just appears blank, then you click in it and it initiates onload (where I have some code to pull values)
Here is what happens when you open up TESTCustomer (the main form)
No data is displayed as you can see..... as soon as you *click* in the subform you get the following:
Data being displayed! This only happens when you CLICK in that subform.
now... something else to consider.. I have ANOTHER Form + Subform combo doing the same thing. You open it, and RIGHT away the subform displays its data (based on a query, just like the other one). Don't have to click in the subform at all, it just shows it:
I've checked the code for both and its VERY similar:
CODE FROM THE SUBFORM THAT DISPLAYS DATA UPON FORMLOAD:
CODE FROM THE FORM THAT DOES NOT DISPLAY DATA ON FORM LOAD:
Any Ideas??
Here is what happens when you open up TESTCustomer (the main form)
No data is displayed as you can see..... as soon as you *click* in the subform you get the following:
Data being displayed! This only happens when you CLICK in that subform.
now... something else to consider.. I have ANOTHER Form + Subform combo doing the same thing. You open it, and RIGHT away the subform displays its data (based on a query, just like the other one). Don't have to click in the subform at all, it just shows it:
I've checked the code for both and its VERY similar:
CODE FROM THE SUBFORM THAT DISPLAYS DATA UPON FORMLOAD:
Code:
Private Sub Form_Current()
Dim strSQL As String
Dim ConInt As Integer
Dim strCount As String
Dim cSQL As String
Dim fSQL As String
Dim pSQL As String
Dim vSQL As String
'***************************************************************************************************************
'***************************************************************************************************************
'*** For reference the coresponding c, f, p and v stand for the first letter of their respective table. ***
'*** c = Customers ***
'*** f = Facilities ***
'*** p = PO ***
'*** v = Vendor ***
'***************************************************************************************************************
'***************************************************************************************************************
'ConInt = 3 '<-- for testing STATIC integers rather than a dynamic number
ConInt = Forms!frmContacts!ContactID
strSQL = "SELECT ContactDetails.ContactID, ContactDetails.ObjectID, ContactDetails.ContactType FROM ContactDetails WHERE ContactDetails.ContactID = " & ConInt & ";"
Me.RecordSource = strSQL
strCount = DCount("[ContactID]", "ContactDetails")
Me.TxtCount = strCount
cSQL = "SELECT CustomerID, Customer_Name FROM Customers;"
fSQL = "SELECT FacilityID, Facility_Name FROM Facilities;"
pSQL = "SELECT POID, PONumber FROM PO;"
vSQL = "SELECT VendorID, VendorName FROM Vendor;"
If sbfrmContactDetails_ContactType = "c" Then sbfrmContactDetails_ObjectID.RowSource = cSQL
If sbfrmContactDetails_ContactType = "f" Then sbfrmContactDetails_ObjectID.RowSource = fSQL
If sbfrmContactDetails_ContactType = "p" Then sbfrmContactDetails_ObjectID.RowSource = pSQL
If sbfrmContactDetails_ContactType = "v" Then sbfrmContactDetails_ObjectID.RowSource = vSQL
End Sub
CODE FROM THE FORM THAT DOES NOT DISPLAY DATA ON FORM LOAD:
Code:
Private Sub Form_Load()
Dim strSQL As String
Dim CustInt As Integer
'CustInt = Forms!TESTCustomer!CustomerID
CustInt = 3
strSQL = "SELECT FacilityID, Facility_Name, Address1, City, State, Zip, IIf([FacilityID]=Null,'','Edit') AS EDIT FROM Facilities WHERE Facilities.CustomerID = " & CustInt & ";"
Me.RecordSource = strSQL
MsgBox "Form LOAD Event!"
End Sub
Any Ideas??