E
every1luvsVB via AccessMonster.com
Hi people,
I wrote a nice little class method that does a dlookup on form_load of the
start up form. basically if the dlookup returns a value, i assign this to the
caption property of the form..
now i built and tested this and it works fine and i have built onto the app
further since over a number of days / development sessions..
NOW all of a sudden, the app decides to crash on startup, giving me the
'Access is sorry to inconvenience you but has to close -do you want to send
an error report.. etc.'
- held the SHIFT key down and tried again, bypassing the startup code and it
opened without a hitch -i then went ahead and commented out all my form_load
code (for the dlookup..) -tried starting app again without the SHIFT key down
and again, it starts without a problem..
Could any of you learned developers tell me what is wrong with my code?? -the
thing that gets me is that it WAS working and NOTHING was changed to cause it
to suddenly not work..
********************************************************
* Here is my class method:
********************************************************
Public Sub loadEnvironment(thisForm As Form, strSpecificCaption As String)
'This subroutine can be called onLoad of each form to add title, logo, etc...
Dim strClubName, strImagePath, strLogoFileName As Variant
strClubName = DLookup("[txtClubName]", "tblEnvironment")
strImagePath = DLookup("[txtImagePath]", "tblEnvironment")
strLogoFileName = DLookup("[txtLogoFileName]", "tblEnvironment")
'Dynamically load Club Name...
thisForm.Caption = strClubName & " - Membership Application: " &
strSpecificCaption
'If form is not datasheet type; and Logo exists, dynamically load Logo...
If Not (thisForm.DefaultView = 2) Then
If Not IsNull(strLogoFileName) Then
thisForm!imgLogoContainer.Picture = strImagePath &
strLogoFileName
End If
End If
End Sub
********************************************************
* Here is my form_load call:
********************************************************
On Error GoTo Err_Form_Load
Dim varClubName As Variant
Dim mdlUtils As clsUtilities
Set mdlUtils = New clsUtilities
Call mdlUtils.loadEnvironment(Me, "Main Menu")
'If no Club Name value currently exists onLoad of the application,
'then prompt the user to enter one...
varClubName = DLookup("[txtClubName]", "tblEnvironment")
If IsNull(varClubName) Then
Dim WarnMsg As String
Me!tabctlMainMenu.Pages!pgAdmin.SetFocus
WarnMsg = "There is currently no Club Name defined for this
application." & vbCrLf & vbCrLf & "Click the 'Administer Environment' button
to enter a new Club Name..."
MsgBox (WarnMsg)
End If
Exit_Form_Load:
Exit Sub
Err_Form_Load:
MsgBox Err.Description
Resume Exit_Form_Load
********************************************************
Thanks heaps for any advice!
I wrote a nice little class method that does a dlookup on form_load of the
start up form. basically if the dlookup returns a value, i assign this to the
caption property of the form..
now i built and tested this and it works fine and i have built onto the app
further since over a number of days / development sessions..
NOW all of a sudden, the app decides to crash on startup, giving me the
'Access is sorry to inconvenience you but has to close -do you want to send
an error report.. etc.'
- held the SHIFT key down and tried again, bypassing the startup code and it
opened without a hitch -i then went ahead and commented out all my form_load
code (for the dlookup..) -tried starting app again without the SHIFT key down
and again, it starts without a problem..
Could any of you learned developers tell me what is wrong with my code?? -the
thing that gets me is that it WAS working and NOTHING was changed to cause it
to suddenly not work..
********************************************************
* Here is my class method:
********************************************************
Public Sub loadEnvironment(thisForm As Form, strSpecificCaption As String)
'This subroutine can be called onLoad of each form to add title, logo, etc...
Dim strClubName, strImagePath, strLogoFileName As Variant
strClubName = DLookup("[txtClubName]", "tblEnvironment")
strImagePath = DLookup("[txtImagePath]", "tblEnvironment")
strLogoFileName = DLookup("[txtLogoFileName]", "tblEnvironment")
'Dynamically load Club Name...
thisForm.Caption = strClubName & " - Membership Application: " &
strSpecificCaption
'If form is not datasheet type; and Logo exists, dynamically load Logo...
If Not (thisForm.DefaultView = 2) Then
If Not IsNull(strLogoFileName) Then
thisForm!imgLogoContainer.Picture = strImagePath &
strLogoFileName
End If
End If
End Sub
********************************************************
* Here is my form_load call:
********************************************************
On Error GoTo Err_Form_Load
Dim varClubName As Variant
Dim mdlUtils As clsUtilities
Set mdlUtils = New clsUtilities
Call mdlUtils.loadEnvironment(Me, "Main Menu")
'If no Club Name value currently exists onLoad of the application,
'then prompt the user to enter one...
varClubName = DLookup("[txtClubName]", "tblEnvironment")
If IsNull(varClubName) Then
Dim WarnMsg As String
Me!tabctlMainMenu.Pages!pgAdmin.SetFocus
WarnMsg = "There is currently no Club Name defined for this
application." & vbCrLf & vbCrLf & "Click the 'Administer Environment' button
to enter a new Club Name..."
MsgBox (WarnMsg)
End If
Exit_Form_Load:
Exit Sub
Err_Form_Load:
MsgBox Err.Description
Resume Exit_Form_Load
********************************************************
Thanks heaps for any advice!