Solved

Cannot assign value to text box.

Posted on 2008-10-02
6
785 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Copy a row 12 75
Access Object Property from VBA Module in Excel 2010 2 44
Set email body to html using vbscript 6 90
Set WorkSheet  not Working 9 62
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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

739 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