SQL problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

Can someone help me with the following problem:

SQLValid = "Select * from [Item Master] where [part #] = '" _
& [Forms]![Actual Stocktake]![YPROD]& "'"

Now what I am trying to do is select something from the item master where
[valid or invalid] = V. How can I add this to the existing query I have
stated above?

What I did try was add another WHERE part to this statement

SQLValid = "Select * from [Item Master] where [part #] ='" and [valid or
invalid]=v
& [Forms]![Actual Stocktake]![YPROD] & "'"

However when I do this, I recieve the following error - compile error -
syntax error. When I have made minor adjustments to this query I always get a
compile error relating to the [valid or invalid] not being defined.

If anyone has any suggestions, that would be great.
 
Try

SQLValid = "Select * from [Item Master] where [part #] ='" & [Forms]![Actual
Stocktake]![YPROD] & "' And [valid or invalid]= 'v'"
 
Thanks for your help Ofer, but I recieve the following error message

Compile Error - External Name Not Defined

![YPROD] is highlighted.

If you know any other way around this, that would be great.

Cheers
Jack

Ofer Cohen said:
Try

SQLValid = "Select * from [Item Master] where [part #] ='" & [Forms]![Actual
Stocktake]![YPROD] & "' And [valid or invalid]= 'v'"


--
Good Luck
BS"D


Jack said:
Hi

Can someone help me with the following problem:

SQLValid = "Select * from [Item Master] where [part #] = '" _
& [Forms]![Actual Stocktake]![YPROD]& "'"

Now what I am trying to do is select something from the item master where
[valid or invalid] = V. How can I add this to the existing query I have
stated above?

What I did try was add another WHERE part to this statement

SQLValid = "Select * from [Item Master] where [part #] ='" and [valid or
invalid]=v
& [Forms]![Actual Stocktake]![YPROD] & "'"

However when I do this, I recieve the following error - compile error -
syntax error. When I have made minor adjustments to this query I always get a
compile error relating to the [valid or invalid] not being defined.

If anyone has any suggestions, that would be great.
 
You probably copy and paste the SQL that I provided, and the SQL was cut to a
second row.
Try

SQLValid = "Select * from [Item Master] where [part #] = " & _
"'" & [Forms]![Actual Stocktake]![YPROD] & _
"' And [valid or invalid]= 'v'"

--
Good Luck
BS"D


Jack said:
Thanks for your help Ofer, but I recieve the following error message

Compile Error - External Name Not Defined

![YPROD] is highlighted.

If you know any other way around this, that would be great.

Cheers
Jack

Ofer Cohen said:
Try

SQLValid = "Select * from [Item Master] where [part #] ='" & [Forms]![Actual
Stocktake]![YPROD] & "' And [valid or invalid]= 'v'"


--
Good Luck
BS"D


Jack said:
Hi

Can someone help me with the following problem:

SQLValid = "Select * from [Item Master] where [part #] = '" _
& [Forms]![Actual Stocktake]![YPROD]& "'"

Now what I am trying to do is select something from the item master where
[valid or invalid] = V. How can I add this to the existing query I have
stated above?

What I did try was add another WHERE part to this statement

SQLValid = "Select * from [Item Master] where [part #] ='" and [valid or
invalid]=v
& [Forms]![Actual Stocktake]![YPROD] & "'"

However when I do this, I recieve the following error - compile error -
syntax error. When I have made minor adjustments to this query I always get a
compile error relating to the [valid or invalid] not being defined.

If anyone has any suggestions, that would be great.
 
Really appreciate your help Ofer, but I now have another problem"

PROGRAM ERROR
An Error has occured. Error #3061
Too few parameters. Expected 1

Cheers
Jack

Ofer Cohen said:
You probably copy and paste the SQL that I provided, and the SQL was cut to a
second row.
Try

SQLValid = "Select * from [Item Master] where [part #] = " & _
"'" & [Forms]![Actual Stocktake]![YPROD] & _
"' And [valid or invalid]= 'v'"

--
Good Luck
BS"D


Jack said:
Thanks for your help Ofer, but I recieve the following error message

Compile Error - External Name Not Defined

![YPROD] is highlighted.

If you know any other way around this, that would be great.

Cheers
Jack

Ofer Cohen said:
Try

SQLValid = "Select * from [Item Master] where [part #] ='" & [Forms]![Actual
Stocktake]![YPROD] & "' And [valid or invalid]= 'v'"


--
Good Luck
BS"D


:

Hi

Can someone help me with the following problem:

SQLValid = "Select * from [Item Master] where [part #] = '" _
& [Forms]![Actual Stocktake]![YPROD]& "'"

Now what I am trying to do is select something from the item master where
[valid or invalid] = V. How can I add this to the existing query I have
stated above?

What I did try was add another WHERE part to this statement

SQLValid = "Select * from [Item Master] where [part #] ='" and [valid or
invalid]=v
& [Forms]![Actual Stocktake]![YPROD] & "'"

However when I do this, I recieve the following error - compile error -
syntax error. When I have made minor adjustments to this query I always get a
compile error relating to the [valid or invalid] not being defined.

If anyone has any suggestions, that would be great.
 
Ignore the previous message - You have solved my problem.

THANK YOU VERY MUCH OFER.



Jack said:
Really appreciate your help Ofer, but I now have another problem"

PROGRAM ERROR
An Error has occured. Error #3061
Too few parameters. Expected 1

Cheers
Jack

Ofer Cohen said:
You probably copy and paste the SQL that I provided, and the SQL was cut to a
second row.
Try

SQLValid = "Select * from [Item Master] where [part #] = " & _
"'" & [Forms]![Actual Stocktake]![YPROD] & _
"' And [valid or invalid]= 'v'"

--
Good Luck
BS"D


Jack said:
Thanks for your help Ofer, but I recieve the following error message

Compile Error - External Name Not Defined

![YPROD] is highlighted.

If you know any other way around this, that would be great.

Cheers
Jack

:

Try

SQLValid = "Select * from [Item Master] where [part #] ='" & [Forms]![Actual
Stocktake]![YPROD] & "' And [valid or invalid]= 'v'"


--
Good Luck
BS"D


:

Hi

Can someone help me with the following problem:

SQLValid = "Select * from [Item Master] where [part #] = '" _
& [Forms]![Actual Stocktake]![YPROD]& "'"

Now what I am trying to do is select something from the item master where
[valid or invalid] = V. How can I add this to the existing query I have
stated above?

What I did try was add another WHERE part to this statement

SQLValid = "Select * from [Item Master] where [part #] ='" and [valid or
invalid]=v
& [Forms]![Actual Stocktake]![YPROD] & "'"

However when I do this, I recieve the following error - compile error -
syntax error. When I have made minor adjustments to this query I always get a
compile error relating to the [valid or invalid] not being defined.

If anyone has any suggestions, that would be great.
 
Back
Top