where...and... where...

  • Thread starter mark_jm via AccessMonster.com
  • Start date
M

mark_jm via AccessMonster.com

I am tyring to write a row source in a combo to select crtaim data from a
table where 2 conditions are met. I'm having problems with the syntax.

Currently looks like this

SELECT [Warranty claims table].[claim no], [Warranty claims table].[claiming
dealer] FROM [Warranty claims table] WHERE [claiming dealer]=[forms].
[credit_note_create_form].[claiming dealer] AND [approvedcdt] =[forms].
[credit_note_create_form].[approvdcdt] [ORDER BY [claim no];

Help says missing operator in expresion.

Any ideas any one.

Mark
 
J

John Spencer

TRY

SELECT [Warranty claims table].[claim no]
, [Warranty claims table].[claiming dealer]
FROM [Warranty claims table]
WHERE [claiming dealer]=[forms]![credit_note_create_form]![claiming dealer]
AND [approvedcdt] =[forms]![credit_note_create_form]![approvdcdt]
ORDER BY [claim no];

-- References to controls on forms should use the ! delimiter and not the .
delimiter.
-- There was an extraneous "[" just before ORDER BY


John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
J

John W. Vinson

I am tyring to write a row source in a combo to select crtaim data from a
table where 2 conditions are met. I'm having problems with the syntax.

Currently looks like this

SELECT [Warranty claims table].[claim no], [Warranty claims table].[claiming
dealer] FROM [Warranty claims table] WHERE [claiming dealer]=[forms].
[credit_note_create_form].[claiming dealer] AND [approvedcdt] =[forms].
[credit_note_create_form].[approvdcdt] [ORDER BY [claim no];

Help says missing operator in expresion.

Any ideas any one.

Mark

As written, you have an extra open bracket before the word ORDER.

You may also want to specify that the date field is recognized as a date. Try

PARAMETERS [forms].[credit_note_create_form].[claiming dealer] Text,
[forms].[credit_note_create_form].[approvdcdt] Date/Time;
SELECT [Warranty claims table].[claim no],
[Warranty claims table].[claiming dealer]
FROM [Warranty claims table]
WHERE [claiming dealer]=[forms].[credit_note_create_form].[claiming dealer]
AND [approvedcdt] =[forms].[credit_note_create_form].[approvdcdt]
ORDER BY [claim no];
 
M

mark_jm via AccessMonster.com

Thanks That worked well.

I am also trying to call a function written in VBA using the runcode command
within the macro window.

How do I declare the function and then call it succesfully.

I am trying to do this because I have some append queries running as a click
event on a button. Ordinarilly I would just write the code and put that on
the click event, but I cant becasue the append query via the macro is there ?


John said:
TRY

SELECT [Warranty claims table].[claim no]
, [Warranty claims table].[claiming dealer]
FROM [Warranty claims table]
WHERE [claiming dealer]=[forms]![credit_note_create_form]![claiming dealer]
AND [approvedcdt] =[forms]![credit_note_create_form]![approvdcdt]
ORDER BY [claim no];

-- References to controls on forms should use the ! delimiter and not the .
delimiter.
-- There was an extraneous "[" just before ORDER BY

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
I am tyring to write a row source in a combo to select crtaim data from a
table where 2 conditions are met. I'm having problems with the syntax.
[quoted text clipped - 11 lines]
 
Top