Full Version: Form Not Opening
UtterAccess Forums > Microsoft® Access > Access Forms
River59
Having a little quirk opening an Access 2013 form. This form is opened from another form with the command
DoCmd.OpenForm "SubformAuditSumm", acNormal

This subform we are opening has an On_Load Event that runs:

Private Sub Form_Load()

Dim dlrmstr As DAO.Recordset
Set dlrmstr = CurrentDb.OpenRecordset("Dealer Master")
Dim aud As DAO.Recordset
Set aud = CurrentDb.OpenRecordset("Audit Summary Dtls")

If aud.RecordCount > 0 Then
Form_SubformAuditSumm.rptDealerName.Value = aud!rptDealerName
Form_SubformAuditSumm.rptAuditScopeStart.Value = aud!rptAuditScopeStart
Form_SubformAuditSumm.rptAuditScopeEnd.Value = aud!rptAuditScopeEnd
Form_SubformAuditSumm.rptCountryOrBrand.Value = aud!rptCountryOrBrand
Form_SubformAuditSumm.rptNoOfDays.Value = aud!rptNoOfDays
Form_SubformAuditSumm.rptDebitAmount.Value = aud!rptDebitAmount
Form_SubformAuditSumm.rptNoOfClaims.Value = aud!rptNoOfClaims
Form_SubformAuditSumm.rptDebitAmount.Value = aud!rptDebitAmount
Form_SubformAuditSumm.rptRemarks.Value = aud!rptRemarks
Form_SubformAuditSumm.rptDealerRep.Value = aud!rptDealerRep

Else
Form_SubformAuditSumm.rptDealerName.Value = dlrmstr![Dealer Owner Name]
Form_SubformAuditSumm.rptAuditScopeStart.Value = DMin("[Claim Date]", "[Pull List]")
Form_SubformAuditSumm.rptAuditScopeEnd.Value = DMax("[Claim Date]", "[Pull List]")
Form_SubformAuditSumm.rptCountryOrBrand.Value = dlrmstr![country]

End If

End Sub

The problem is that this form will not open. If I open the form in design view, then try to open it, it is just fine.
I go to design view, then switch right to form view and every works perfectly?????????????
sirluke34
Are you trying to open the subform stand alone? Is the subform linked to a normal form with master/child records? So you have a main form with a button that opens this subform, right? Do you get an error or when you click it does nothing happen?
River59
That is what was happening. The form just would not open.
There was no link between the Main form and subform. The Main form simply acted as a switchboard from which the user could open a form or generate a report.

Weird though that if I opened the subform manually in design mode then closed it, the code ran fine.
I just took the code on the subform's Form_Load event and put it in the subform's Form_Open event. Seems to have sovled the problem.

Thanks for taking a look. I accidently posted this issue twice (yikes!)
missinglinq
A new quirk in Access (like it needed another quirk!) that has appeared, fairly recently, on a number of forums, involves code/macros running, when switching from Design View to Form View, but not running if the Form is then closed and re-opened directly in Form View! It turns out that the Redmond developers assumed that if your are working from 'inside' Access, as it were, you were 'trust-worthy,' so code will run, even if the Folder holding the file hasn't been declared as a 'Trusted' site! But when opened directly, that Folder needs to have that 'Trusted' attribute in place.

Sorry, don't have a step-by-step for marking a Folder as 'trusted,' in 2013, but I suspect that it'll be under Options.

Linq ;0)>
River59
missinglinq, when I see your avatar I don't know if you're laughing at me or crying over the futility of it all, but it always makes me smile.

Thanks for the input. I think a lot of problems are when databases are developed in one version of Access then moved to another. This particular database says 2007-2013 file format. I just inherited it and get emails from users about some weird thing it is doing here and there. Seems it's been in use for some time but every now and then only one or two users will have a problem. Most of the maintainenace is massaging around these random issues that pop up.

The users actually download the database, run their files, then hold onto them to work through the entire process (can take 2-3 months). Each time they do a new run, they download a new copy of the database to their pc to work with and store the 'used copy'. Therefore, I have to wonder how much affect the Trust Center settings are. Thanks for your input though. You have helped me on a number of occasions and I appreciate input from people who have been around a while.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.