G
GillesScouvart via AccessMonster.com
Hi all,
I have a form where the user can input a string in a textbox as the
description of a new record to be created (via append query). Then I need to
have other queries run using the PK on this new record.
I'm trying to get this PK by using:
SELECT TOP 1 SetID
FROM Sets
WHERE (((Sets.Description)=[Forms]![myForm].[txtSet])) ORDER BY SetID
DESC;
but it appears that the [Forms]![myFom].[txtSet] is null.
However, executing the following code in immediate window
debug.print([Forms]![F1 BOM tool]![txtSet])
gives me the right string ("this is a test").
And hardcoding the string also gives the right result:
SELECT TOP 1 SetID
FROM Sets
WHERE (((Sets.Description)="this is a test") ORDER BY SetID DESC;
Any idea on what may cause this problem (differences SQL vs VBA notations?
unsynchronized updates?)?
Thanks!
I have a form where the user can input a string in a textbox as the
description of a new record to be created (via append query). Then I need to
have other queries run using the PK on this new record.
I'm trying to get this PK by using:
SELECT TOP 1 SetID
FROM Sets
WHERE (((Sets.Description)=[Forms]![myForm].[txtSet])) ORDER BY SetID
DESC;
but it appears that the [Forms]![myFom].[txtSet] is null.
However, executing the following code in immediate window
debug.print([Forms]![F1 BOM tool]![txtSet])
gives me the right string ("this is a test").
And hardcoding the string also gives the right result:
SELECT TOP 1 SetID
FROM Sets
WHERE (((Sets.Description)="this is a test") ORDER BY SetID DESC;
Any idea on what may cause this problem (differences SQL vs VBA notations?
unsynchronized updates?)?
Thanks!