Discussion Locked
0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I need to create a calculated field in a query that creates a new field in a table.The calculated field is based on an if , then statement. For example if field X contains A , then multiple field Y by -1 and create field Z. Show examples and proper syntax.
3 replies
by peyison
You can't create a new field in a table via a query.
You can create a calculated result for a field that already exists:
INSERT INTO tblTable1 (ResultField)
SELECT IIf([X]="A",[Y]*-1,[Y]) AS Result
FROM tblTable2;
This will insert a new record in tblTable1 and set the field ResultField to:
If field X in tblTable2 = "A" then tblTable1.ResultField = tblTable2.Y * -1
Else tblTable1.ResultField = tblTable2.Y
Hope this helps
by hsackner
Poster rated this answer
by hsackner
This question was closed by the author
This discussion is closed to new replies.
Trending Community archive posts
Sort by Trending
0 helpful
2 replies
Discussion Locked
how can i save my gmail data as pdf for offline access
0 helpful
1 reply
Discussion
What makes a simple web tool actually useful
0 helpful
1 reply
0 helpful
1 reply
0 helpful
1 reply