Explanation on Error Message

E

Eka1618

Hello,

I have posted a thread called "Argument Error in Union Query" in the query
section here, but noone knows what is wrong.

First, I just want to know what the following error message mens:

An Expression in Argument 2 has an Invalid Value"

I am using a union query to join results from two different queries. What
has happened is that when i made the Union Query, I started recieveing this
error message, and then the two queries that are being combined in the Union
query are also displaying this error when I try to run them seperately.

I do not know what is wrong what-so-ever. Both queries are selecting the
same information, just a different where clause. Here is the SQL for all of
the queries (they are quite long):

Here is my Union Query (qryTorqueResultUnionRPT):

SELECT Q_INC, Q_ID, SAMPLE_NO, TENSION, NOTES, OBSERVATIONS, L_PART_NO,
K_PART_NO, PAT_NO, PAT_SIZE, PICTURE
FROM qryCustomTorqueRPT
UNION
SELECT Q_INC, Q_ID, SAMPLE_NO, TENSION, NOTES, OBSERVATIONS, L_PART_NO,
K_PART_NO, PAT_NO, PAT_SIZE, PICTURE
FROM qryCustomMultiTorqueRPT
ORDER BY qryCustomTorqueRpt.Q_INC;


qryCustomTorqueRPT:

SELECT tblResults.Q_INC, tblResults.Q_ID, tblResults.SAMPLE_NO,
tblResults.TENSION, tblResults.NOTES, tblResults.OBSERVATIONS,
tblResults.L_PART_NO, tblResults.K_PART_NO, tblResults.PAT_NO,
tblResults.PAT_SIZE, tblResults.PICTURE
FROM tblResults
WHERE ((tblResults.L_ID)
In (select L_ID from tblLock
Where (L_EWO_NO = [forms].[frmCustomResultReport].[cmbLEWO] OR
[forms].[frmCustomResultReport].[cmbLEWO] = "<all>") AND (L_PART_NO =
[forms].[frmCustomResultReport].[cmbLPart] OR
[forms].[frmCustomResultReport].[cmbLPart] = "<all>") AND (L_SKID_NO =
[forms].[frmCustomResultReport].[cmbLSKID] OR
[forms].[frmCustomResultReport].[cmbLSKID] = "<all>") AND (L_MAT_TYPE =
[forms].[frmCustomResultReport].[cmbLMatType] OR
[forms].[frmCustomResultReport].[cmbLMatType] = "<all>") AND (L_MAT_HEAT =
[forms].[frmCustomResultReport].[cmbLMatHeat] OR
[forms].[frmCustomResultReport].[cmbLMatHeat] = "<all>") AND (L_HARD =
[forms].[frmCustomResultReport].[cmbLHard] OR
[forms].[frmCustomResultReport].[cmbLHard] = "<all>") AND (L_PLAT =
[forms].[frmCustomResultReport].[cmbLPlat] OR
[forms].[frmCustomResultReport].[cmbLPlat] = "<all>") AND (L_TOP_COAT =
[forms].[frmCustomResultReport].[cmbLCoat] OR
[forms].[frmCustomResultReport].[cmbLCoat] = "<all>") AND (L_THREAD =
[forms].[frmCustomResultReport].[cmbLThread] OR
[forms].[frmCustomResultReport].[cmbLThread] = "<all>") )
AND (tblResults.K_ID) IN (Select K_ID from tblKey Where (K_EWO_NO =
[forms].[frmCustomResultReport].[cmbKEWO] OR
[forms].[frmCustomResultReport].[cmbKEWO] = "<all>") AND (K_PART_NO =
[forms].[frmCustomResultReport].[cmbKPart] OR
[forms].[frmCustomResultReport].[cmbKPart] = "<all>") AND (K_SKID_NO =
[forms].[frmCustomResultReport].[cmbKSKID] OR
[forms].[frmCustomResultReport].[cmbKSKID] = "<all>") AND (K_MAT_TYPE =
[forms].[frmCustomResultReport].[cmbKMatType] OR
[forms].[frmCustomResultReport].[cmbKMatType] = "<all>") AND (K_MAT_HEAT =
[forms].[frmCustomResultReport].[cmbKMatHeat] OR
[forms].[frmCustomResultReport].[cmbKMatHeat] = "<all>") AND (K_HARD =
[forms].[frmCustomResultReport].[cmbKHard] OR
[forms].[frmCustomResultReport].[cmbKHard] = "<all>") AND (K_PLAT =
[forms].[frmCustomResultReport].[cmbKPlat] OR
[forms].[frmCustomResultReport].[cmbKPlat] = "<all>") AND (K_TOP_COAT =
[forms].[frmCustomResultReport].[cmbKCoat] OR
[forms].[frmCustomResultReport].[cmbKCoat] = "<all>") )
AND (tblResults.PAT_NO) IN (Select PAT_NO from tblPattern Where ( PAT_NO =
[forms].[frmCustomResultReport].[cmbPatNo] OR
[forms].[frmCustomResultReport].[cmbPatNo] = 0) )
AND (tblResults.PAT_SIZE) IN (Select PAT_SIZE from tblPattern Where
(PAT_SIZE = [forms].[frmCustomResultReport].[cmbPatSize] OR
[forms].[frmCustomResultReport].[cmbPatSize] = "<all>" ))
AND tblResults.TEST_TYPE = "TORQUE TENSION" );


qryCustomMultiTorqueRPT:

SELECT tblResults.Q_INC, tblResults.Q_ID, tblResults.SAMPLE_NO,
tblResults.TENSION, tblResults.NOTES, tblResults.OBSERVATIONS,
tblResults.L_PART_NO, tblResults.K_PART_NO, tblResults.PAT_NO,
tblResults.PAT_SIZE, tblResults.PICTURE
FROM tblResults
WHERE ((tblResults.L_K_ID)
In (select L_K_ID from tblLock_Key
Where (L_EWO_NO = [forms].[frmCustomResultReport].[cmbLEWO] OR
[forms].[frmCustomResultReport].[cmbLEWO] = "<all>") AND (L_PART_NO =
[forms].[frmCustomResultReport].[cmbLPart] OR
[forms].[frmCustomResultReport].[cmbLPart] = "<all>") AND (L_SKID_NO =
[forms].[frmCustomResultReport].[cmbLSKID] OR
[forms].[frmCustomResultReport].[cmbLSKID] = "<all>") AND (L_MAT_TYPE =
[forms].[frmCustomResultReport].[cmbLMatType] OR
[forms].[frmCustomResultReport].[cmbLMatType] = "<all>") AND (L_MAT_HEAT =
[forms].[frmCustomResultReport].[cmbLMatHeat] OR
[forms].[frmCustomResultReport].[cmbLMatHeat] = "<all>") AND (L_HARD =
[forms].[frmCustomResultReport].[cmbLHard] OR
[forms].[frmCustomResultReport].[cmbLHard] = "<all>") AND (L_PLAT =
[forms].[frmCustomResultReport].[cmbLPlat] OR
[forms].[frmCustomResultReport].[cmbLPlat] = "<all>") AND (L_TOP_COAT =
[forms].[frmCustomResultReport].[cmbLCoat] OR
[forms].[frmCustomResultReport].[cmbLCoat] = "<all>") AND (L_THREAD =
[forms].[frmCustomResultReport].[cmbLThread] OR
[forms].[frmCustomResultReport].[cmbLThread] = "<all>") AND (K_EWO_NO =
[forms].[frmCustomResultReport].[cmbKEWO] OR
[forms].[frmCustomResultReport].[cmbKEWO] = "<all>") AND (K_PART_NO =
[forms].[frmCustomResultReport].[cmbKPart] OR
[forms].[frmCustomResultReport].[cmbKPart] = "<all>") AND (K_SKID_NO =
[forms].[frmCustomResultReport].[cmbKSKID] OR
[forms].[frmCustomResultReport].[cmbKSKID] = "<all>") AND (K_MAT_TYPE =
[forms].[frmCustomResultReport].[cmbKMatType] OR
[forms].[frmCustomResultReport].[cmbKMatType] = "<all>") AND (K_MAT_HEAT =
[forms].[frmCustomResultReport].[cmbKMatHeat] OR
[forms].[frmCustomResultReport].[cmbKMatHeat] = "<all>") AND (K_HARD =
[forms].[frmCustomResultReport].[cmbKHard] OR
[forms].[frmCustomResultReport].[cmbKHard] = "<all>") AND (K_PLAT =
[forms].[frmCustomResultReport].[cmbKPlat] OR
[forms].[frmCustomResultReport].[cmbKPlat] = "<all>") AND (K_TOP_COAT =
[forms].[frmCustomResultReport].[cmbKCoat] OR
[forms].[frmCustomResultReport].[cmbKCoat] = "<all>") )
AND (tblResults.PAT_NO) IN (Select PAT_NO from tblLKPattern Where ( PAT_NO =
[forms].[frmCustomResultReport].[cmbPatNo] OR
[forms].[frmCustomResultReport].[cmbPatNo] = 0) )
AND (tblResults.PAT_SIZE) IN (Select PAT_SIZE from tblLKPattern Where
(PAT_SIZE = [forms].[frmCustomResultReport].[cmbPatSize] OR
[forms].[frmCustomResultReport].[cmbPatSize] = "<all>" ))
AND tblResults.TEST_TYPE = "TORQUE TENSION" );


IF anyone knows what I can do, please please let me know, Thank You!

~Erica~
 
E

Eka1618

Well I solved the error, It ended up being an error in how I was trying to
open the query in VB.

Explanation is in the other thread in Access Queries

~Erica~

Eka1618 said:
Hello,

I have posted a thread called "Argument Error in Union Query" in the query
section here, but noone knows what is wrong.

First, I just want to know what the following error message mens:

An Expression in Argument 2 has an Invalid Value"

I am using a union query to join results from two different queries. What
has happened is that when i made the Union Query, I started recieveing this
error message, and then the two queries that are being combined in the Union
query are also displaying this error when I try to run them seperately.

I do not know what is wrong what-so-ever. Both queries are selecting the
same information, just a different where clause. Here is the SQL for all of
the queries (they are quite long):

Here is my Union Query (qryTorqueResultUnionRPT):

SELECT Q_INC, Q_ID, SAMPLE_NO, TENSION, NOTES, OBSERVATIONS, L_PART_NO,
K_PART_NO, PAT_NO, PAT_SIZE, PICTURE
FROM qryCustomTorqueRPT
UNION
SELECT Q_INC, Q_ID, SAMPLE_NO, TENSION, NOTES, OBSERVATIONS, L_PART_NO,
K_PART_NO, PAT_NO, PAT_SIZE, PICTURE
FROM qryCustomMultiTorqueRPT
ORDER BY qryCustomTorqueRpt.Q_INC;


qryCustomTorqueRPT:

SELECT tblResults.Q_INC, tblResults.Q_ID, tblResults.SAMPLE_NO,
tblResults.TENSION, tblResults.NOTES, tblResults.OBSERVATIONS,
tblResults.L_PART_NO, tblResults.K_PART_NO, tblResults.PAT_NO,
tblResults.PAT_SIZE, tblResults.PICTURE
FROM tblResults
WHERE ((tblResults.L_ID)
In (select L_ID from tblLock
Where (L_EWO_NO = [forms].[frmCustomResultReport].[cmbLEWO] OR
[forms].[frmCustomResultReport].[cmbLEWO] = "<all>") AND (L_PART_NO =
[forms].[frmCustomResultReport].[cmbLPart] OR
[forms].[frmCustomResultReport].[cmbLPart] = "<all>") AND (L_SKID_NO =
[forms].[frmCustomResultReport].[cmbLSKID] OR
[forms].[frmCustomResultReport].[cmbLSKID] = "<all>") AND (L_MAT_TYPE =
[forms].[frmCustomResultReport].[cmbLMatType] OR
[forms].[frmCustomResultReport].[cmbLMatType] = "<all>") AND (L_MAT_HEAT =
[forms].[frmCustomResultReport].[cmbLMatHeat] OR
[forms].[frmCustomResultReport].[cmbLMatHeat] = "<all>") AND (L_HARD =
[forms].[frmCustomResultReport].[cmbLHard] OR
[forms].[frmCustomResultReport].[cmbLHard] = "<all>") AND (L_PLAT =
[forms].[frmCustomResultReport].[cmbLPlat] OR
[forms].[frmCustomResultReport].[cmbLPlat] = "<all>") AND (L_TOP_COAT =
[forms].[frmCustomResultReport].[cmbLCoat] OR
[forms].[frmCustomResultReport].[cmbLCoat] = "<all>") AND (L_THREAD =
[forms].[frmCustomResultReport].[cmbLThread] OR
[forms].[frmCustomResultReport].[cmbLThread] = "<all>") )
AND (tblResults.K_ID) IN (Select K_ID from tblKey Where (K_EWO_NO =
[forms].[frmCustomResultReport].[cmbKEWO] OR
[forms].[frmCustomResultReport].[cmbKEWO] = "<all>") AND (K_PART_NO =
[forms].[frmCustomResultReport].[cmbKPart] OR
[forms].[frmCustomResultReport].[cmbKPart] = "<all>") AND (K_SKID_NO =
[forms].[frmCustomResultReport].[cmbKSKID] OR
[forms].[frmCustomResultReport].[cmbKSKID] = "<all>") AND (K_MAT_TYPE =
[forms].[frmCustomResultReport].[cmbKMatType] OR
[forms].[frmCustomResultReport].[cmbKMatType] = "<all>") AND (K_MAT_HEAT =
[forms].[frmCustomResultReport].[cmbKMatHeat] OR
[forms].[frmCustomResultReport].[cmbKMatHeat] = "<all>") AND (K_HARD =
[forms].[frmCustomResultReport].[cmbKHard] OR
[forms].[frmCustomResultReport].[cmbKHard] = "<all>") AND (K_PLAT =
[forms].[frmCustomResultReport].[cmbKPlat] OR
[forms].[frmCustomResultReport].[cmbKPlat] = "<all>") AND (K_TOP_COAT =
[forms].[frmCustomResultReport].[cmbKCoat] OR
[forms].[frmCustomResultReport].[cmbKCoat] = "<all>") )
AND (tblResults.PAT_NO) IN (Select PAT_NO from tblPattern Where ( PAT_NO =
[forms].[frmCustomResultReport].[cmbPatNo] OR
[forms].[frmCustomResultReport].[cmbPatNo] = 0) )
AND (tblResults.PAT_SIZE) IN (Select PAT_SIZE from tblPattern Where
(PAT_SIZE = [forms].[frmCustomResultReport].[cmbPatSize] OR
[forms].[frmCustomResultReport].[cmbPatSize] = "<all>" ))
AND tblResults.TEST_TYPE = "TORQUE TENSION" );


qryCustomMultiTorqueRPT:

SELECT tblResults.Q_INC, tblResults.Q_ID, tblResults.SAMPLE_NO,
tblResults.TENSION, tblResults.NOTES, tblResults.OBSERVATIONS,
tblResults.L_PART_NO, tblResults.K_PART_NO, tblResults.PAT_NO,
tblResults.PAT_SIZE, tblResults.PICTURE
FROM tblResults
WHERE ((tblResults.L_K_ID)
In (select L_K_ID from tblLock_Key
Where (L_EWO_NO = [forms].[frmCustomResultReport].[cmbLEWO] OR
[forms].[frmCustomResultReport].[cmbLEWO] = "<all>") AND (L_PART_NO =
[forms].[frmCustomResultReport].[cmbLPart] OR
[forms].[frmCustomResultReport].[cmbLPart] = "<all>") AND (L_SKID_NO =
[forms].[frmCustomResultReport].[cmbLSKID] OR
[forms].[frmCustomResultReport].[cmbLSKID] = "<all>") AND (L_MAT_TYPE =
[forms].[frmCustomResultReport].[cmbLMatType] OR
[forms].[frmCustomResultReport].[cmbLMatType] = "<all>") AND (L_MAT_HEAT =
[forms].[frmCustomResultReport].[cmbLMatHeat] OR
[forms].[frmCustomResultReport].[cmbLMatHeat] = "<all>") AND (L_HARD =
[forms].[frmCustomResultReport].[cmbLHard] OR
[forms].[frmCustomResultReport].[cmbLHard] = "<all>") AND (L_PLAT =
[forms].[frmCustomResultReport].[cmbLPlat] OR
[forms].[frmCustomResultReport].[cmbLPlat] = "<all>") AND (L_TOP_COAT =
[forms].[frmCustomResultReport].[cmbLCoat] OR
[forms].[frmCustomResultReport].[cmbLCoat] = "<all>") AND (L_THREAD =
[forms].[frmCustomResultReport].[cmbLThread] OR
[forms].[frmCustomResultReport].[cmbLThread] = "<all>") AND (K_EWO_NO =
[forms].[frmCustomResultReport].[cmbKEWO] OR
[forms].[frmCustomResultReport].[cmbKEWO] = "<all>") AND (K_PART_NO =
[forms].[frmCustomResultReport].[cmbKPart] OR
[forms].[frmCustomResultReport].[cmbKPart] = "<all>") AND (K_SKID_NO =
[forms].[frmCustomResultReport].[cmbKSKID] OR
[forms].[frmCustomResultReport].[cmbKSKID] = "<all>") AND (K_MAT_TYPE =
[forms].[frmCustomResultReport].[cmbKMatType] OR
[forms].[frmCustomResultReport].[cmbKMatType] = "<all>") AND (K_MAT_HEAT =
[forms].[frmCustomResultReport].[cmbKMatHeat] OR
[forms].[frmCustomResultReport].[cmbKMatHeat] = "<all>") AND (K_HARD =
[forms].[frmCustomResultReport].[cmbKHard] OR
[forms].[frmCustomResultReport].[cmbKHard] = "<all>") AND (K_PLAT =
[forms].[frmCustomResultReport].[cmbKPlat] OR
[forms].[frmCustomResultReport].[cmbKPlat] = "<all>") AND (K_TOP_COAT =
[forms].[frmCustomResultReport].[cmbKCoat] OR
[forms].[frmCustomResultReport].[cmbKCoat] = "<all>") )
AND (tblResults.PAT_NO) IN (Select PAT_NO from tblLKPattern Where ( PAT_NO =
[forms].[frmCustomResultReport].[cmbPatNo] OR
[forms].[frmCustomResultReport].[cmbPatNo] = 0) )
AND (tblResults.PAT_SIZE) IN (Select PAT_SIZE from tblLKPattern Where
(PAT_SIZE = [forms].[frmCustomResultReport].[cmbPatSize] OR
[forms].[frmCustomResultReport].[cmbPatSize] = "<all>" ))
AND tblResults.TEST_TYPE = "TORQUE TENSION" );


IF anyone knows what I can do, please please let me know, Thank You!

~Erica~
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top