My Form Load Code does not work

  • Follow


I created a form with a combo box. On this combo box I have a "NotInList" 
code to open a form call "Customers" and I placed an "OnLoad" code on the 
customers form.
My problem is the customers form does not open as expected. I am getting a 
run-time error which states "You can't assign a value to this object"
The onload code on the customers form is as follows: 

Private Sub Form_Load()
If IsNull(Me.OpenArgs) = False Then
   
   Me.CompanyName = Me.OpenArgs
   
End If

End Sub

Someone please help me. I am completed lost. This code is working fine in 3 
other access databases, but for some reason it will not work in this new one.

Please help.

Thank you.
0
Reply Utf 5/17/2007 2:41:03 PM

Your OnLoad event code should work if you have a control named CompanyName on
that form.  As a diagnostic, try using a different TextBox control and see if
it works.

Pierre wrote:
>I created a form with a combo box. On this combo box I have a "NotInList" 
>code to open a form call "Customers" and I placed an "OnLoad" code on the 
>customers form.
>My problem is the customers form does not open as expected. I am getting a 
>run-time error which states "You can't assign a value to this object"
>The onload code on the customers form is as follows: 
>
>Private Sub Form_Load()
>If IsNull(Me.OpenArgs) = False Then
>   
>   Me.CompanyName = Me.OpenArgs
>   
>End If
>
>End Sub
>
>Someone please help me. I am completed lost. This code is working fine in 3 
>other access databases, but for some reason it will not work in this new one.
>
>Please help.
>
>Thank you.

-- 
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200705/1

0
Reply ruralguy 5/17/2007 4:21:35 PM


I tried as you recommended, but I am still getting the same error.
Run-time error-2147352567 (80020009)

Thank You

"ruralguy via AccessMonster.com" wrote:

> Your OnLoad event code should work if you have a control named CompanyName on
> that form.  As a diagnostic, try using a different TextBox control and see if
> it works.
> 
> Pierre wrote:
> >I created a form with a combo box. On this combo box I have a "NotInList" 
> >code to open a form call "Customers" and I placed an "OnLoad" code on the 
> >customers form.
> >My problem is the customers form does not open as expected. I am getting a 
> >run-time error which states "You can't assign a value to this object"
> >The onload code on the customers form is as follows: 
> >
> >Private Sub Form_Load()
> >If IsNull(Me.OpenArgs) = False Then
> >   
> >   Me.CompanyName = Me.OpenArgs
> >   
> >End If
> >
> >End Sub
> >
> >Someone please help me. I am completed lost. This code is working fine in 3 
> >other access databases, but for some reason it will not work in this new one.
> >
> >Please help.
> >
> >Thank you.
> 
> -- 
> HTH - RuralGuy (RG for short) acXP WinXP Pro
> Please post back to this forum so all may benefit.
> 
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200705/1
> 
> 
0
Reply Utf 5/17/2007 5:23:00 PM

It sounds like something is wrong with that form.
Try a /decompile:  http://www.granite.ab.ca/access/decompile.htm



Pierre wrote:
>I tried as you recommended, but I am still getting the same error.
>Run-time error-2147352567 (80020009)
>
>Thank You
>
>> Your OnLoad event code should work if you have a control named CompanyName on
>> that form.  As a diagnostic, try using a different TextBox control and see if
>[quoted text clipped - 22 lines]
>> >
>> >Thank you.

-- 
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200705/1

0
Reply ruralguy 5/17/2007 5:38:39 PM

Excellent!  It felt like there was some sort of corruption going on.  Glad
you got it sorted.

Pierre wrote:
>The decompling did not work. 
>I created anew database using all the same codes and it works. The first 
>database was started by someone else and ai think they may have made some 
>mistakes before I got the database.
>
>Any how, thank you very much for you help. You gave me the idea that 
>something was wrong with the form, but once I changed the form the problem 
>followed.
>
>Once again thanks alot, I will sleep well tonight.
>
>> It sounds like something is wrong with that form.
>> Try a /decompile:  http://www.granite.ab.ca/access/decompile.htm
>[quoted text clipped - 9 lines]
>> >> >
>> >> >Thank you.

-- 
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200705/1

0
Reply ruralguy 5/17/2007 11:07:25 PM

4 Replies
603 Views

(page loaded in 0.051 seconds)

Similiar Articles:
















7/23/2012 3:02:22 PM


Reply: