Query based on field in form, not working in 2007

G

Guest

Hi

After upgrading to Access 2007 (from 2003), I have a query that has stopped
working. It is something like

SECELT id
FROM [tbl names]
WHERE ([tbl names].firstname = [forms]![My form][firstname]);

It does not seem to register the value of the "firstname" textbox in the
form [My Form]. Accordign to the SQL profiler, the query just sends an empty
field "". Therefore instead of searching for a specific entry, I get all my
entries... The query seemed to work fine in Access 2002 and 2003.

When using

WHERE ([tbl names].firstname LIKE "*" & [forms]![My form][firstname] & "*");

the result is the same.
 
G

Guest

I do not know if it was a typo but your post is missing an exclamination mark
to be like this ---
SECELT id
FROM [tbl names]
WHERE ([tbl names].firstname = [forms]![My form]![firstname]);
 
G

Guest

Yes, sorry about that, typo... Any ideas to what could be wrong? The query is
executed from within the form as part of filter command.

/Martin

KARL DEWEY said:
I do not know if it was a typo but your post is missing an exclamination mark
to be like this ---
SECELT id
FROM [tbl names]
WHERE ([tbl names].firstname = [forms]![My form]![firstname]);

--
KARL DEWEY
Build a little - Test a little


Martin Edwards said:
Hi

After upgrading to Access 2007 (from 2003), I have a query that has stopped
working. It is something like

SECELT id
FROM [tbl names]
WHERE ([tbl names].firstname = [forms]![My form][firstname]);

It does not seem to register the value of the "firstname" textbox in the
form [My Form]. Accordign to the SQL profiler, the query just sends an empty
field "". Therefore instead of searching for a specific entry, I get all my
entries... The query seemed to work fine in Access 2002 and 2003.

When using

WHERE ([tbl names].firstname LIKE "*" & [forms]![My form][firstname] & "*");

the result is the same.
 
G

Guest

Did you try opening the form, enter first name, then separately run the query
to see what the results are?
--
KARL DEWEY
Build a little - Test a little


Martin Edwards said:
Yes, sorry about that, typo... Any ideas to what could be wrong? The query is
executed from within the form as part of filter command.

/Martin

KARL DEWEY said:
I do not know if it was a typo but your post is missing an exclamination mark
to be like this ---
SECELT id
FROM [tbl names]
WHERE ([tbl names].firstname = [forms]![My form]![firstname]);

--
KARL DEWEY
Build a little - Test a little


Martin Edwards said:
Hi

After upgrading to Access 2007 (from 2003), I have a query that has stopped
working. It is something like

SECELT id
FROM [tbl names]
WHERE ([tbl names].firstname = [forms]![My form][firstname]);

It does not seem to register the value of the "firstname" textbox in the
form [My Form]. Accordign to the SQL profiler, the query just sends an empty
field "". Therefore instead of searching for a specific entry, I get all my
entries... The query seemed to work fine in Access 2002 and 2003.

When using

WHERE ([tbl names].firstname LIKE "*" & [forms]![My form][firstname] & "*");

the result is the same.
 
G

Guest

Unfortunately yes, but with no result. The funny thing is that it worked like
a charme in 2003. Even if I write something false instead of [firstname] like

WHERE ([tbl names].firstname = [forms]![My form]![firstvsdklvnname]);

it returns the same results.

/Martin

KARL DEWEY said:
Did you try opening the form, enter first name, then separately run the query
to see what the results are?
--
KARL DEWEY
Build a little - Test a little


Martin Edwards said:
Yes, sorry about that, typo... Any ideas to what could be wrong? The query is
executed from within the form as part of filter command.

/Martin

KARL DEWEY said:
I do not know if it was a typo but your post is missing an exclamination mark
to be like this ---
SECELT id
FROM [tbl names]
WHERE ([tbl names].firstname = [forms]![My form]![firstname]);

--
KARL DEWEY
Build a little - Test a little


:

Hi

After upgrading to Access 2007 (from 2003), I have a query that has stopped
working. It is something like

SECELT id
FROM [tbl names]
WHERE ([tbl names].firstname = [forms]![My form][firstname]);

It does not seem to register the value of the "firstname" textbox in the
form [My Form]. Accordign to the SQL profiler, the query just sends an empty
field "". Therefore instead of searching for a specific entry, I get all my
entries... The query seemed to work fine in Access 2002 and 2003.

When using

WHERE ([tbl names].firstname LIKE "*" & [forms]![My form][firstname] & "*");

the result is the same.
 
G

Guest

Have you tried opening the form, enter first name, then separately run this
query ---
SELECT AnyTableName.*, [forms]![My form]![firstname] AS My_Guess
FROM AnyTableName;

See what is displayed for My_Guess.

--
KARL DEWEY
Build a little - Test a little


Martin Edwards said:
Unfortunately yes, but with no result. The funny thing is that it worked like
a charme in 2003. Even if I write something false instead of [firstname] like

WHERE ([tbl names].firstname = [forms]![My form]![firstvsdklvnname]);

it returns the same results.

/Martin

KARL DEWEY said:
Did you try opening the form, enter first name, then separately run the query
to see what the results are?
--
KARL DEWEY
Build a little - Test a little


Martin Edwards said:
Yes, sorry about that, typo... Any ideas to what could be wrong? The query is
executed from within the form as part of filter command.

/Martin

:

I do not know if it was a typo but your post is missing an exclamination mark
to be like this ---
SECELT id
FROM [tbl names]
WHERE ([tbl names].firstname = [forms]![My form]![firstname]);

--
KARL DEWEY
Build a little - Test a little


:

Hi

After upgrading to Access 2007 (from 2003), I have a query that has stopped
working. It is something like

SECELT id
FROM [tbl names]
WHERE ([tbl names].firstname = [forms]![My form][firstname]);

It does not seem to register the value of the "firstname" textbox in the
form [My Form]. Accordign to the SQL profiler, the query just sends an empty
field "". Therefore instead of searching for a specific entry, I get all my
entries... The query seemed to work fine in Access 2002 and 2003.

When using

WHERE ([tbl names].firstname LIKE "*" & [forms]![My form][firstname] & "*");

the result is the same.
 

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