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

Assigning A Value To A Field In A One Row Table With VBA

P: n/a
How can this be done and what is the syntax?
Thanks,
Sheldon Potolsky
Nov 29 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Thu, 29 Nov 2007 13:05:30 -0800 (PST), Sheldon wrote:
How can this be done and what is the syntax?
Thanks,
Sheldon Potolsky
The table has one record? O.K.
The field you wish to give a value to is what datatype?
And the value you wish to enter is what?

CurrentDb.Execute "Update YourTable Set YourTable.[FieldName] =
'What?';", dbFailOnError

Now if you had spent a bit more time on your message and given more
particulars, I could have given you the correct syntax for the
datatype of the field you wish to update, as it is different for
Number, Text, and Date datatypes.
As it is, the syntax is correct for a Text datatype field.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Nov 29 '07 #2

P: n/a
On Nov 29, 4:54 pm, fredg <fgutk...@example.invalidwrote:
On Thu, 29 Nov 2007 13:05:30 -0800 (PST), Sheldon wrote:
How can this be done and what is the syntax?
Thanks,
Sheldon Potolsky

The table has one record? O.K.
The field you wish to give a value to is what datatype?
And the value you wish to enter is what?

CurrentDb.Execute "Update YourTable Set YourTable.[FieldName] =
'What?';", dbFailOnError

Now if you had spent a bit more time on your message and given more
particulars, I could have given you the correct syntax for the
datatype of the field you wish to update, as it is different for
Number, Text, and Date datatypes.
As it is, the syntax is correct for a Text datatype field.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
The table has a "SchoolYear" field, text, length of 4 e.g. 2007. The
field value in the table should change when a field in a form changes.
Thanks, Sheldon
Nov 30 '07 #3

P: n/a
Sheldon wrote:
On Nov 29, 4:54 pm, fredg <fgutk...@example.invalidwrote:
>>On Thu, 29 Nov 2007 13:05:30 -0800 (PST), Sheldon wrote:
>>>How can this be done and what is the syntax?
Thanks,
Sheldon Potolsky

The table has one record? O.K.
The field you wish to give a value to is what datatype?
And the value you wish to enter is what?

CurrentDb.Execute "Update YourTable Set YourTable.[FieldName] =
'What?';", dbFailOnError

Now if you had spent a bit more time on your message and given more
particulars, I could have given you the correct syntax for the
datatype of the field you wish to update, as it is different for
Number, Text, and Date datatypes.
As it is, the syntax is correct for a Text datatype field.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail


The table has a "SchoolYear" field, text, length of 4 e.g. 2007. The
field value in the table should change when a field in a form changes.
Thanks, Sheldon
In your form add SchoolYear. You can make it visible or not. Let's say
you have a Yes/No field called Student. And the value changes in
Student. In the AfterUpdate event of Student you could enter something like
If Student then
Me.SchoolYear = 2007
Else
Me.SchoolYear = Null
Endif
Nov 30 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.