473,326 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

passing value from vb to a field

when I try to do the following:

me.myfield.value = "test" I get the following error:

You can't assign a value to this object

Am I doing something wrong?
Nov 20 '07 #1
7 1393
ADezii
8,834 Expert 8TB
when I try to do the following:

me.myfield.value = "test" I get the following error:

You can't assign a value to this object

Am I doing something wrong?
Is [myfield] a Control on a Form, and if so what Type of Control is it, and what is the context under which the Value is being assigned?
Nov 20 '07 #2
yes it is a text field - does that make sense?
Nov 20 '07 #3
here is some more information -

If I do this:
me.label15.caption = "test"
it works

If I do this:
me.textfld1.value = "test"
it doesn't work

Is there no way for me to pass text to a text field like this from vb?
Nov 20 '07 #4
missinglinq
3,532 Expert 2GB
Exactly where in code are you trying to pass this data? IT would probably help if we could see the entire sub.

Welcome to TheScripts!

Linq ;0)>
Nov 20 '07 #5
I'm trying to just set a text field equal to a variable (genvar1) -
I have not been able to get this to work so I just tried to pass a simple string by changing me.colUNK.Value = "Test" just to test that I could pass anything and I have been unable to pass even this simple string.


Private Sub BuildGender()

'count the number of students with unknown gender
strsql = "SELECT TECH_ID FROM [Visit Summary] WHERE [Gender] not in ('F', 'M') GROUP BY Tech_id ;"
Set rst = dbs.OpenRecordset(strsql)
If rst.RecordCount <> 0 Then rst.MoveLast
genvar1 = rst.RecordCount

Me.ColUNK.Value = "Test"

End Sub
Nov 20 '07 #6
ADezii
8,834 Expert 8TB
I'm trying to just set a text field equal to a variable (genvar1) -
I have not been able to get this to work so I just tried to pass a simple string by changing me.colUNK.Value = "Test" just to test that I could pass anything and I have been unable to pass even this simple string.


Private Sub BuildGender()

'count the number of students with unknown gender
strsql = "SELECT TECH_ID FROM [Visit Summary] WHERE [Gender] not in ('F', 'M') GROUP BY Tech_id ;"
Set rst = dbs.OpenRecordset(strsql)
If rst.RecordCount <> 0 Then rst.MoveLast
genvar1 = rst.RecordCount

Me.ColUNK.Value = "Test"

End Sub
Is the Sub-Routine BuildGender() in your Form's Code Module and does this Form contain the [ColUNK] Text Field? The Code also need to be improved, but let's get past this hurdle first. If BuildGender() is not in the Form's Code
Module that contains the [ColUNK] Field, and if that Form is Open, then you need the Absolute Reference to the Text Box as in:
Expand|Select|Wrap|Line Numbers
  1. 'You need not specify the Default Property
  2. Forms![<Your Form Name Here>]![ColUNK] = "Test"
Nov 21 '07 #7
missinglinq
3,532 Expert 2GB
Where/how does Sub BuildGender() get called? And does the rest of the procedure execute correctly?

Linq ;0)>
Nov 21 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Paul | last post by:
I want to use sessions to cover myself in case the user switches off cookies so I am passing the session ID manually through a hidden input field. This is what I have so far. index.php page...
1
by: Paul | last post by:
Hmmm, didn't seem to work. I have set session.use_cookies = 1 and session.use_trans_sid = 1 in my php.ini file. Index.php contains:...
12
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the...
1
by: Kevin Lyons | last post by:
Hello, I am trying to get all of my form elements passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html to the following URL:...
8
by: kalinga1234 | last post by:
there is a problem regarding passing array of characters to another function(without using structures,pointer etc,).can anybody help me to solve the problem.
7
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID...
1
by: Maria | last post by:
Hello! I am new to Crystal reports an I have problems passing parameters form outside to Crystal report an creating a report with data from more than one table This is the problem: I have to...
4
by: Sahil Malik [MVP] | last post by:
Okay so now I understand (surprised though) - that WebServices can indeed pass ByRef/ref parameters. All I have to do is mark an integer parameter of a WebMethod as "ref". Funnily enough, this is...
17
by: Christopher Benson-Manica | last post by:
Does the following program exhibit undefined behavior? Specifically, does passing a struct by value cause undefined behavior if that struct has as a member a pointer that has been passed to...
0
isladogs
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...
0
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...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
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)...
1
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
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....
0
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
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.