My Form Load Code does not work

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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.
 
I tried as you recommended, but I am still getting the same error.
Run-time error-2147352567 (80020009)

Thank You
 
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]
 
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
 
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]
 
Back
Top