My Form Load Code does not work

G

Guest

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.
 
R

ruralguy via AccessMonster.com

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.
 
G

Guest

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

Thank You
 
R

ruralguy via AccessMonster.com

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


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]
 
G

Guest

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.


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


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
 
R

ruralguy via AccessMonster.com

Excellent! It felt like there was some sort of corruption going on. Glad
you got it sorted.
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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top