Cotswold
Active member
- Local time
- Today, 19:21
- Joined
- Dec 31, 2020
- Messages
- 698
I Want to transfer the field contents to memory variables and to do that I presume I'll need to convert a Variable to a Literal.
In the olden days with Clipper87 I'd just prefix with an ampersand to do that but I've never noticed anything like it in other languages I've used. I've shown a section of code where the save will take place and am wondering of there is a way to save the value of mTemp1 to memory variables named as each Fieldname but prefixed with "m"
In the olden days with Clipper87 I'd just prefix with an ampersand to do that but I've never noticed anything like it in other languages I've used. I've shown a section of code where the save will take place and am wondering of there is a way to save the value of mTemp1 to memory variables named as each Fieldname but prefixed with "m"
Code:
a simple form with just three fields Test0, Test2 and Test3
.....
.....
'setting Memory Variables
Dim mTest0, mTest2, mTest3 as String
Dim mTemp, mTemp1 as String
.....
....
'Now to step through the From Fields and store their content to mmory
For Each Ctrl in Screen.Active.Form.Controls
If Ctrl.ControlType = acTextBox then
mTemp = Ctrl.Name ' Fieldname
mTemp1 = Ctrl ' Field content
at this point I know the Fieldname and its content. The next thing is to store
that value into the correct memory variable, in this case mTest0, or mTest2 or mTest3
depending upon the position in the For Each Ctrl/ Next loop. Which is where I guess I
need to convert a Variable to a Literal.
(the position of fields in Controls may change as new ones are added, so only the
Fieldname will be constant)
....
....
Next Ctrl
.....
more code
Last edited: