Well I have been trying as I might to take two tables and merge their
values, the SQL capabilities seem quite limited in Access 2013. In fact
in Form view, it tells me it can't even handle mathematical conditional
statements.
Some success, I have managed to Access to work with my SQL statement
below:
SELECT TableB.*, TableA.* FROM TableA INNER JOIN TableB ON
(TableA.FieldA <= Int(TableB.FieldA_high)) AND (TableA.FieldA >
Int(TableB.FieldA_low));
TableA FieldA
TableB FieldA_high FieldA_low
Has managed to create a nice joined table where TableA.FieldA has
matched up the relevant limited records from TableB.
However that's where the problems begin. I can't seem to take this
merged database and add a new field onto the results that considers
FieldsB, FieldC on TableB And FieldC FieldB on TableA
What makes it even harder is that TableB has Text values in those two
fields, which should be an integer, and it is a read-only table that
can't have its values changed (it has certain template values)
Once the above query is successfully implemented, I want it to take the
new query table and fill values into FieldC, an integer field with no
values presently in TableA. I have considered the ramifications that if I don't
evaluate the statement below correctly I might get a division by zero,
hence the if statement:
iif(
int(TableB.FieldC>0) AND TableA.FieldB>0),
TableA.FieldC =
(TableA.FieldA*(int(TableB.FieldB))/(TableA.FieldB)*int(TableB.FieldC),
TableA.FieldC=0)
Do I need to edit this in visual basic, or is there some way I can get
the Union to work without an error message in Access 2013 trying to
implement the SQL statement.
Given that TableB's fields may also be NUL, how do I account for that?
I tried moving the semicolon after my
Union statement to no avail. It gives me messages that I don't have an INPUT, or DELETE statement correctly stated.
Do I need to make multiple query tables including all the values of the table in each statement to get one final query that has the values I want?
What is the simplest way to achieve this?