Do not use objects in SELECT SQL. In the time and place where the SQL runs there might simply be no THISFORM.
Consider to replace the Thisform.MyField.Value like the following example.
.rowsource = "Select Code from Mytable where Type = ["+Thisform.MyField.Value+"] into Cursor MyCursor"
everytime you change the value in Thisform.MyField you need to redefine the .rowssource.
Agnes
>Hi All
>I have a combo box with Sql command as source
>This works fine:
>Select Code from Mytable where Type = 'ABC' into Cursor MyCursor
>
>However, if the where is taken from another field on the screen as in
>Select Code from Mytable where Type = Thisform.MyField.Value into Cursor MyCursor
> nothing is selected even though MyField.Value contains 'ABC'
>
>Anybody got any ideas ?
>Regards,
>Gerard
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord
Weeks of programming can save you hours of planning.
OffThere is no place like [::1]