By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,490 Members | 897 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,490 IT Pros & Developers. It's quick & easy.

EVAL

P: n/a
Hi All,

I've been trying to get a simple code to run but it hasn't been easy...
I'm designing a Form in Access 2003 and where a givemn event takes place I call up a Function. Basically, the Function holds 2 arguments. One of them is the name of the field in the form to change, the other one is the value.

Here's the function:

Function LastUpdate(nField, TempVar)
Dim strCtl As String

strCtl = "Forms![Pipeline]![" & nField & "]=" & TempVar
Eval (strCtl)
Me.[ProjectCode].SetFocus

End Function

Here's how I call it:

Call LastUpdate("GoGet", iGoget)

In the end, the [GoGet] field doesn't store the value that I pass through the TempVar variable.
In Debug Mode, I can see that the strCtl is ok but somehow the EVAL function isn't producing the effect that I want.

Anyone?

Thanks
Antonio

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
António,

Try this code in the Form's module:

Function LastUpdate(nField, TempVar)
Dim rCtl As Access.Control

Set rCtl = Me.Controls(nField)
rCtl.Value = TempVar
Me.[ProjectCode].SetFocus

End Function

-Ken

Nov 13 '05 #2

P: n/a
jv
Try this instead of eval(). Forms("PipeLine")(nField) = TempVar

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.