473,498 Members | 1,725 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can a string variable be used as a line of code in VB?

1 New Member
I Dimmed a string variable and then built a line of code which I set equal to the variable. Is there a way to now use that variable as a line of VB code?

Expand|Select|Wrap|Line Numbers
  1.     If Me.chkPris4None And Me.chkPris4Lac Then
  2.         Call Correction("Pris", "4")
  3.         GoTo Leave
  4.     End If
  5.  
  6. Private Sub Correction(kind, pers)
  7.     Dim retval As String
  8.     MsgBox "Can't have 'None' AND injury box checked.", vbOKOnly, "Data Error"
  9.     retval = "me.chk" & kind & pers & "None = 0"
  10. End Sub
  11.  
Feb 2 '11 #1
1 1048
Guido Geurs
767 Recognized Expert Contributor
Code can't be set in a string!
Why do You want to set a code in a string?
In retval there is only the TEXT = "me.chkPris4None = 0".
Nothing can reset this to a code.
Feb 3 '11 #2

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

Similar topics

16
10440
by: PK9 | last post by:
I have a string variable that holds the equivalent of a DateTime value. I pulled this datetime from the database and I want to strip off the time portion before displaying to the user. I am...
4
4201
by: JohnR | last post by:
Hi all, I'm finally sick and tired of manually generating get/set properties for each private variable in a class so I'm trying to create a macro to do it. I'm stuck because I can't figure out...
15
16279
by: Daren | last post by:
Hi, I need to be able to split large string variables into an array of lines, each line can be no longer than 70 chars. The string variables are text, so I would additionally like the lines...
5
2894
by: CarlWSummers | last post by:
I'm doing something wrong. I'm parsing a string into rational numbers (int/int) by looking for spaces in the string, assinging a substring of the original string to a temporary variable, and...
5
2791
by: Generic Usenet Account | last post by:
I have been to recreate a problem that I am having with strings with the trivial code snippet given below. In the trivial code example, I am reading five lines from a data file, each line having...
1
1970
by: Rob | last post by:
Hey folks, I should be ashamed for not knowing the answer to this question - but I don't get the opportunity to program all that much anymore... I have a data tracking program used by over 150...
9
1983
by: Erwin Moller | last post by:
Hi all, Is it possible (PHP5.2) to find the name of a variable used in the caller of a function from within the function itself? Or to be more clear: ...php code.. $result = foo($abc);...
2
2012
by: Looch | last post by:
All, I'm trying to output but I can only get (brackets for clarity) when using the code below. How can I "break" into the query variable in the InsertName method to add the name parameter to...
2
3188
by: slimewizard | last post by:
Hello there! I'm writing a 'hang man' program as a bit of a practice exercise and I've ran into a bit of a problem; I just need a little advise if anyone would be so kind. My apologies if this...
0
7125
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7002
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7205
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6887
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5462
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4910
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4590
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3093
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1419
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.