In the Report i need to change the value for a textbox at runtime.Below is my code used to change the value.But i m getting an error "Can't assign value to this object". - Private Sub Report_Open(Cancel As Integer)
-
Dim a As String
-
a = InputBox("enter the add")
-
Me.Text2 = a
-
End Sub
Plz guide me as how can i change the Textbox value at runtime..
6 18364
You need to change the event to Detail_Format in order for it to assign to the textbox. So, change your code from: -
Private Sub Report_Open(Cancel As Integer)
-
Dim a As String
-
a = InputBox("enter the add")
-
Me.Text2 = a
-
End Sub
-
to the following: -
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
-
Dim a As String
-
a = InputBox("enter the add")
-
Me.Text2 = a
-
End Sub
-
and it should work.
Out of curiousity, what are you using this for? Is your report unbound?
Hello Beacon,
I tried the above code in the Detail_Format event but its not working..
May b I m going something wrong in the Control source property...
Actually the Report in my DB is something like a Label which would randomly go on printing the Address...,once the specific Address is given.So i tried this out with the Input Box..
Below is the Control source property value for the Textbox which shud print the
data as
For ex-South Avenue-3 08 FL 45 1st storey
=[a] & [Plot] & " FL" & [Level] & " - " & [Location].
Plz help me to rectify this..
Your 'a' is something the user is going to type in, so I hope it's something really short ... not a whole address! I'm not sure I know what you are trying to do, exactly. You could have another go at explaining the exact purpose of the report.
Anyway, what you can do is go to report properties 'other' and set the Filter property to ...
Address = Enter_Address
... and the Filter On Load property to Yes
Now when you open the report an 'automatic' input box will come up asking for the address, and the report will open just for that address.
But why do you want to do this?
Hi Shalskedar,
The solution I sent you works, but only if the text box is unbound. The reason it won't work for you is because your text box isn't unbound. Once you enter something into the Control Source, the text box can no longer have a value assigned to it dynamically, like in my example.
For whatever it is that you are trying to do, since you still haven't really explained what your ultimate goal is, you will have to employ a different method...either using a form to pass your parameter to the query that the report is based on (go to http://www.fontstuff.com/access/acctut08.htm for more details) or maybe using the method that Juliet offered.
I may have replied too soon. I went back in and removed the control source that I entered in my test database that I was using to recreate your problem, then put the info into the code and it worked, sorta. The input box appears for EVERY record that will appear on your report, so if you typed "123" in the input box, you'll have to type "123" times the total number of records in your report. Not very handy....but here's the code nontheless.
Change this... -
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
-
Dim a As String
-
a = InputBox("enter the add")
-
Me.Text2 = a
-
End Sub
-
...to this -
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
-
Dim a As String
-
a = InputBox("enter the add")
-
Me.Text2 = a & [Plot] & " FL" & [Level] & " - " & [Location].
-
End Sub
-
Now, you may be able to input the value into a text box for a group header and then reference the text box using a second text box with a control source, but I haven't had time to test that out or not. Honestly, I think trying that out would be a colossal waste of time and would recommend one of the other solutions Juliet and I suggested.
NeoPa 32,556
Expert Mod 16PB
Put a parameter in the recordsource of the report : - SELECT [X],
-
[Y],
-
[Please Enter Address],
-
[Z]
-
FROM [YourTable]
-
etc
Sign in to post your reply or Sign up for a free account.
Similar topics
by: AFN |
last post by:
I'm trying to set a submit button to change text and color when clicked.
Like saying "please wait" instead of "submit" and then changing the
background color and text color. All works, except for...
|
by: Radek Budaø |
last post by:
Hi all,
i have trouble with changing text value of textbox on runtime. I use this
control to display process information about sending e-mail per smtp. I use
external component
>>Imports...
|
by: Giò |
last post by:
Someone knows if is possible to change the value of a property
attribute at runtime, via reflection? I'd change the value of
DescriptionAttribute, but I don't know if is possible. If isn't, is...
|
by: sid derra |
last post by:
hi
i am trying to change the value of a text field on my page dynamically,
every time an iframe loads.
#==========
the code where the text field is looks like this:
<form...
|
by: Rex |
last post by:
Hi,
I want to change a value in one table depending on the value(s) in
another table. I am trying to achieve this in a form.
to elaborate
I have a many-to-many relationship between tables...
|
by: Ringo |
last post by:
I have a windows app that downloads Firmware to a micro. I display the
% done on the form, but I would like to put it in the forms title so
that when it is minimized you can see it on the toolbar....
|
by: brent78 |
last post by:
I am trying to show whether or not a certain type of transaction has occured. The query result displays the text value of the transaction. Is it possible to have this show up as a true/false check...
|
by: vinodkus |
last post by:
dear sir/madam
I have a combo which has 2 values
I want when its value is changed then its value should be display in a
text box.
Thanks In Advance
|
by: joshapalooza |
last post by:
Hi all,
What I'm trying to do is two-fold. We'll tackle one and then the other, or whichever is easiest.
First Question/Problem:
Is it possible to write VBA code that would change a text...
|
by: deegeorge |
last post by:
Hi,
I have an aspx form. In that i have a check box for Credit card payment. When i am submitting that form it need to open a crystal report. If the checkbox is checked
the textbox field in...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |