473,320 Members | 2,133 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,320 software developers and data experts.

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

How can this be done and what is the syntax?
Thanks,
Sheldon Potolsky
Nov 29 '07 #1
3 1547
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: cmckenna82 | last post by:
Hi, I am creating a tool to merge xml files using xslt usin Javascript/HTML. Basically the user browses (browse button) to where there xml file are, then browses to where their xslt file (to...
4
by: Tauqir | last post by:
I am trying to do a simple thing: I have these two text fields in an HTML form. I want to assign the concatenated value to a TEXTAREA. Can someone help me with the syntax? <HTML> <SCRIPT...
4
by: aaaaaa | last post by:
how can i set a field to some value on the query design (so that field always has the same value when the query is launched). I tried to put the value in the criteria but it doesnt asign it ...
2
by: Terry Bickle | last post by:
Please forgive me for using the wrong term here or there. I'm an old Excel 4 macro guy who didn't convert to VB and I'm tinkering with an Access 2000 DB. I'm sure there is a simple Access 101...
8
by: Woody Splawn | last post by:
Lets say I have a winform that is populated with a dataset. The dataset and data table may have several rows in it. Lets say I am looking at the winform and I want to assign a value to a certain...
5
by: Phil Latio | last post by:
I have 2 virtually identical tables and wish to move data between them. Basically one table is called "live_table" and the other is named "suspended_table" and the only difference is that the...
2
by: mukesh | last post by:
Can we use expression in default value for a table field for example – IIf(Table-1.field-1=table-2 . field-1, table-1.field-2, 0) Interpretation – If field-1 of table -1 is like/equal to...
9
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a...
4
by: Dave White | last post by:
Hello Everyone, I have created two tables to track my students' lessons. Each student is responsible for most, but not all. of the lessons. I've tried a junction table but I can't figure out...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
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)...
0
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...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.