Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

With UpdateQuery convert from Text to Number Field 2

Status
Not open for further replies.

4Wile

Programmer
Jul 16, 2001
25
US
Query qryTestUpdate, Tables OldTestTbl and NewTestTbl
OldTestTbl:
OldTestText1 Text
OldTestText2 Text
NewTestTbl:
NewTestText1 Text
NewTestNumber1 Integer
qryTestUpdate:
INSERT INTO NewTestTbl(NewTestText1, NewTestNumber)
SELECT [OldTestTbl].[OldTestText1] AS Expr1, [OldTestTbl].[OldTestText2] AS Expr2
FROM OldTestTbl
Of course, it does not work...I need help!
I'm a Newbie..
 

You didn't tell us the error or problem. You probably had a type mismatch error because you are trying to insert a text value into a numeric column. You need to convert the text value to numeric. Use the CInt function.

Of course, the error could be that the name of the second column of the new table is spelled differently in the Insert statement. Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Terry L. Broadbent..

Remember I'm newbie...
Do you mean NewTestNumber=CInt(OldTestText). If so,
How can it used in a Query(qryTestUpdate)

Bob Foreman
 

In your case you would do something like this.

INSERT INTO NewTestTbl(NewTestText1, NewTestNumber1)
SELECT
[OldTestTbl].[OldTestText1] AS Expr1,
CInt([OldTestTbl].[OldTestText2]) AS Expr2
FROM OldTestTbl

This will only work if OldTestText2 contains numeric data. Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Terry L. Broadbent...

Perfect....Much thanks

Bob Foreman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top