Moving column data

  • Thread starter jln via AccessMonster.com
  • Start date
J

jln via AccessMonster.com

OK i not sure if this can be done in access or not. What i need to do is move
the values in a column named schedbal to the column LiqPrin. The value that
was in schedbal is to be cleared out.
 
J

jln via AccessMonster.com

I understand the code im just not sure where to place it

UPDATE SomeTable SET schedbal = Null, LiqPrin = [schedbal];
OK i not sure if this can be done in access or not. What i need to do is move
the values in a column named schedbal to the column LiqPrin. The value that
was in schedbal is to be cleared out.
 
K

Klatuu

Create an update query based on the table you want to update or if you want
to do it in VBA:

CurrentDb.Execute "UPDATE SomeTable SET schedbal = Null, LiqPrin =
[schedbal];", dbFailOnError

jln via AccessMonster.com said:
I understand the code im just not sure where to place it

UPDATE SomeTable SET schedbal = Null, LiqPrin = [schedbal];
OK i not sure if this can be done in access or not. What i need to do is move
the values in a column named schedbal to the column LiqPrin. The value that
was in schedbal is to be cleared out.
 
J

jln via AccessMonster.com

OK i put that code in and replaced the some table with my table nameand im
getting a syntax error.
Create an update query based on the table you want to update or if you want
to do it in VBA:

CurrentDb.Execute "UPDATE SomeTable SET schedbal = Null, LiqPrin =
[schedbal];", dbFailOnError
I understand the code im just not sure where to place it
[quoted text clipped - 3 lines]
 
K

Klatuu

hhhhmmmm -- I tested it and it worked for me.
Try this version:
CurrentDb.Execute("UPDATE SomeTable SET schedbal = Null, LiqPrin =
[schedbal];"), dbFailOnError

jln via AccessMonster.com said:
OK i put that code in and replaced the some table with my table nameand im
getting a syntax error.
Create an update query based on the table you want to update or if you want
to do it in VBA:

CurrentDb.Execute "UPDATE SomeTable SET schedbal = Null, LiqPrin =
[schedbal];", dbFailOnError
I understand the code im just not sure where to place it
[quoted text clipped - 3 lines]
the values in a column named schedbal to the column LiqPrin. The value that
was in schedbal is to be cleared out.
 
J

jln via AccessMonster.com

OK now when i run it i get to few parmaters
hhhhmmmm -- I tested it and it worked for me.
Try this version:
CurrentDb.Execute("UPDATE SomeTable SET schedbal = Null, LiqPrin =
[schedbal];"), dbFailOnError
OK i put that code in and replaced the some table with my table nameand im
getting a syntax error.
[quoted text clipped - 10 lines]
 
J

jln via AccessMonster.com

Here is how i am using it

Private Sub Command6_Click()
CurrentDb.Execute ("UPDATE PO_Modems SET schedbal = Null, LiqPrin =[schedbal]
;"), dbFailOnError
CurrentDb.Execute ("UPDATE PO_Modems SET Field7 = Null, Ancillary Fees =
[Field7];"), dbFailOnError
End Sub

hhhhmmmm -- I tested it and it worked for me.
Try this version:
CurrentDb.Execute("UPDATE SomeTable SET schedbal = Null, LiqPrin =
[schedbal];"), dbFailOnError
OK i put that code in and replaced the some table with my table nameand im
getting a syntax error.
[quoted text clipped - 10 lines]
 
S

Stefan Hoffmann

hi,
Private Sub Command6_Click()
CurrentDb.Execute ("UPDATE PO_Modems SET schedbal = Null, LiqPrin =[schedbal]
;"), dbFailOnError
The brackets around the string are not necessary, try it without them.


mfG
--> stefan <--
 
J

jln via AccessMonster.com

I tried that aswell and it just gave me a differnt error of invailed syntax.

Stefan said:
hi,
Private Sub Command6_Click()
CurrentDb.Execute ("UPDATE PO_Modems SET schedbal = Null, LiqPrin =[schedbal]
;"), dbFailOnError
The brackets around the string are not necessary, try it without them.

mfG
--> stefan <--
 
S

Stefan Hoffmann

hi,
I tried that aswell and it just gave me a differnt error of invailed syntax.
Where does the debugger stop the code execution?
Private Sub Command6_Click()
CurrentDb.Execute ("UPDATE PO_Modems SET schedbal = Null, LiqPrin =[schedbal]
;"), dbFailOnError
The brackets around the string are not necessary, try it without them.
No typos in your table and fieldnames?
Is the field [schedbal] nullable?


mfG
--> stefan <--
 
J

jln via AccessMonster.com

OK thanks i got it it was the space is there a way tha ti can do it with the
space.

Stefan said:
hi,
I tried that aswell and it just gave me a differnt error of invailed syntax.
Where does the debugger stop the code execution?
Private Sub Command6_Click()
CurrentDb.Execute ("UPDATE PO_Modems SET schedbal = Null, LiqPrin =[schedbal]
;"), dbFailOnError
The brackets around the string are not necessary, try it without them.
No typos in your table and fieldnames?
Is the field [schedbal] nullable?

mfG
--> stefan <--
 
S

Stefan Hoffmann

hi,
OK thanks i got it it was the space is there a way tha ti can do it with the
space.
What space? If a space is used in a table or field name, you have to use
the square brackets: [name with space].


mfG
--> stefan <--
 
J

jln via AccessMonster.com

Thanks that works fine.

Stefan said:
hi,
OK thanks i got it it was the space is there a way tha ti can do it with the
space.
What space? If a space is used in a table or field name, you have to use
the square brackets: [name with space].

mfG
--> stefan <--
 
Top