[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Cannot assign value to text box.

Posted on 2008-10-02
6
Medium Priority
?
789 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses

649 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