Solved

Cannot assign value to text box.

Posted on 2008-10-02
6
779 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
Comment Utility
why not try in other event. for eg in load event?
0
 
LVL 5

Expert Comment

by:gemailj
Comment Utility
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
Comment Utility
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 5

Expert Comment

by:gemailj
Comment Utility
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
Comment Utility
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
Comment Utility
figured it out, i didn't use .Text, but i ended up placing the assignments in the Details Format section
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

762 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

13 Experts available now in Live!

Get 1:1 Help Now