Wierd Subform behavior (Please help)

MsLady

Traumatized by Access
Local time
Today, 01:06
Joined
Jun 14, 2004
Messages
438
When I open my mainform through an onClick event of a button, the form opens up with the subform on it is disabled/closed -- Just a blank white box shows in place of the subform on my mainform. Here:


However, when i go through the objects window and open the mainfrom directly. I am able to enter and update data and the subform shows up and works fine. Here:


This is the code attached to the onClick event on the mainMenu

Code:
Private Sub New_Project_Click()
On Error GoTo Err_New_Project_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Project Status - Full Details2"
    
    stLinkCriteria = "[projectId]= 0"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    [Form_Project Status - Full Details2]![Proj ID].Enabled = False

Exit_New_Project_Click:
    Exit Sub

Err_New_Project_Click:
    MsgBox Err.Description
    Resume Exit_New_Project_Click
    
End Sub

This is the record source on the mainform:
The projectInfomation table is the record source
Code:
 SELECT *
FROM projectInformation;

This is the record source on the subform:
The projectStatusCommentary table is the record source
Code:
SELECT projectStatusCommentary.projStatusId, projectStatusCommentary.projectId, projectStatusCommentary.statusCommentary, projectStatusCommentary.commentaryDate
FROM projectStatusCommentary;

The link fields are:
projectInformation.projectId
projectStatusCommentary.projectId

The tables are in sybase and my application has an ODBC connection to them.
I can update any of the tables directly without issues.
I have ran the queries independently and updated tables through the query and it works fine also.

I have been pulling my hairs out on this for over 3weeks now. cos i can't seem to find what's wrong.
I am not able to attache the db cos it's very huge. But i have copied the problematic form &subform, to a new db so you may see my design, and record sources.

If you have any suggestions, ideas, or you've come across this kind of issue before, anything...please make my new Year a happy one and help :)
I would really appreciate it!
Have a happy and prosperous new year.

Yours truly,
Frustrated one
 

Attachments

Can you include the tables, please? (make copies of the tables as structure only, no data)

Or you can try (for now) using table's name instead of SQL statement (Select statements) for the RecordSource of the subform.
 
Last edited:
HI Supercharge. :)
I have included the table definition in my file (please see attached).

I have tried using the tablename alone as record source and it's still the same problem.
 

Attachments

Every loads fine to me. No white, blank subform.

See picture.
 

Attachments

  • Capture.JPG
    Capture.JPG
    59.8 KB · Views: 122
supercharge said:
Every loads fine to me. No white, blank subform.

See picture.
Thanks supercharge, but
That's because you accessed the form through the objects window! That works fine (see my initial post and screenshots). But if i go through the mainMenu (startup form) onclick event which pulls up this form. A blank /white space subform is what i get. That's why i posted the code on the onclick event and the images.

Also, please dont' forget that my tables are linked Sybase tables. And i am able to update, add, delete data from tables directly, likewise through my queries. :)
 
Last edited:
MsLady said:
...
That's because you accessed the form through the objects window!

No! it was loaded via a command button which uses your posted codes.

See attached.
 

Attachments

supercharge said:
No! it was loaded via a command button which uses your posted codes.

See attached.

Thanks Supercharge:
So my code is not the problem. That's crossed out. But I wonder what could be the problem. Cos the form still comes out like the images i attached when accessed :(
 
Ok now, let's try this.

Using the sample I sent you, directly from the tables, enter some dummy data for projectID 0 and 1 then try loading the form again to see what happens. This will not solve your prob but just try to see what'll show.

The reason you're getting a white, blank subform is that when it loads, it can't find the SourceObject of the subform. It may be blanked out accidentally somewhere within your MainMenu's codes. It'll be helpful it you can also include your mainMenu form where you have the button on; how about your whole database with no records?
 
supercharge said:
Ok now, let's try this.

Using the sample I sent you, directly from the tables, enter some dummy data for projectID 0 and 1 then try loading the form again to see what happens. This will not solve your prob but just try to see what'll show.

The reason you're getting a white, blank subform is that when it loads, it can't find the SourceObject of the subform. It may be blanked out accidentally somewhere within your MainMenu's codes. It'll be helpful it you can also include your mainMenu form where you have the button on; how about your whole database with no records?

Sure...I'll get on it! Give me a a few minutes
Thanksss of your continuing assistance...brb
 
The tables are linked sybase tables,
however i have copied and pasted the structure in access without data.

The main menu is the form - "System Menu", click under forms, "Add new project" to pull up the details form to add a new project. That's where the subform comes out blank.

Now, it shows up properly with my access tables and works fine. It might be my connection with the sybase end or the relationship? between the sybase tables, even though i have set the correct relationships between these tables in the access relationship window. I don't know if there's anything to do with rltionship in sybase...or if its possible to define relationships in sybase. Might have to look for a sybase expert.

It's amazing how my subform can come up blank/not found when i access my form from from a button and show up/performs well when access through the objects...i just don't know. So mysterious!

Attached is the whole DB stripped off it's data. it's pretty huge, so i have uploaded to a url.. http://d12.yousendit.com/F/3DOAVWF5E7FKT1GJ9D2C4DKG65/PostDB.zip

Thanks alot!!
 
Have you tried this to see if it works Okay. If it indeed works okay, you will have to use a different way to filter the form, will get on that later.

Code:
Private Sub New_Project_Click()
On Error GoTo Err_New_Project_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Project Status - Full Details2"
    
    [COLOR="yellowgreen"]'stLinkCriteria = "[projectId]= 0"[/COLOR]
    DoCmd.OpenForm stDocName, , , stLinkCriteria
   [COLOR="YellowGreen"] '[Form_Project Status - Full Details2]![Proj ID].Enabled = False[/COLOR]

Exit_New_Project_Click:
    Exit Sub

Err_New_Project_Click:
    MsgBox Err.Description
    Resume Exit_New_Project_Click
    
End Sub
 

Users who are viewing this thread

Back
Top Bottom