Solved

Cannot assign value to text box.

Posted on 2008-10-02
6
780 Views
Last Modified: 2012-05-05
Seems like an easy one...

I have a global variable that I am correctly populating. I want to take that var and put it in a report to print. Below is my code for the report. I get a

Run-time error '-2147352567(80020009)':
You can't assign a value to this object.

My globals are defined as:

Global globalUsername As String

Thanks.
Private Sub Report_Open(Cancel As Integer)

Me.Text32 = globalFirstName

Me.Text34 = globalLastName

Me.Text35 = globalUsername

Me.Text36 = globalPW

End Sub

Open in new window

0
Comment
Question by:Neil2526
  • 3
  • 2
6 Comments
 
LVL 17

Expert Comment

by:Shanmuga Sundaram
ID: 22625500
why not try in other event. for eg in load event?
0
 
LVL 5

Expert Comment

by:gemailj
ID: 22625547
all you have to do is to use Text property instead of assign a string to the textbox
like this  (Me.Text32.Text = globalFirstName)
instead of (Me.Text32 = globalFirstName)
Private Sub Report_Open(Cancel As Integer)

Me.Text32.Text = globalFirstName

Me.Text34.Text = globalLastName

Me.Text35.Text = globalUsername

Me.Text36.Text = globalPW

End Sub

Open in new window

0
 

Author Comment

by:Neil2526
ID: 22625579
Almost there, gemailj.

I used your suggestion and got an error about focus. So I then added:

Me.Text32.SetFocus before assigning values.

I then got the following error:

myDatabase does not allow you to use this method in the current view.

Does that have anything to do with the way I am calling the report?
below...
DoCmd.OpenReport "rptUsername_Password_populated", acViewPreview

Open in new window

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 5

Expert Comment

by:gemailj
ID: 22625950
no it is not related with how you openthis report,
it is about using this code in -- open event
try to use it in -- load event
0
 

Author Comment

by:Neil2526
ID: 22626560
Thanks for the info, i am currently using this and my break point is  not getting hit.
Private Sub Report_Load()

Me.Text32.SetFocus
 

Me.Text32.Text = globalFirstName

Me.Text34.Text = globalLastName

Me.Text35.Text = globalUsername

Me.Text36.Text = globalPW

End Sub

Open in new window

0
 

Accepted Solution

by:
Neil2526 earned 0 total points
ID: 22627588
figured it out, i didn't use .Text, but i ended up placing the assignments in the Details Format section
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now