OS: Windows 10 LO: Version: 6.4.6.2 (x64) File format: .odb.
NB: Variable “Status” and array “UArray” are declared globally.
The attached subroutine is called by clicking on a row in the view “vwTrain” lying within form “frmUnits”. The underlying table is “tblUnits”. The contents of column 4 are stored within variable “SelectedTrain”. This works OK.
The idea is then to query “tblUnits” to return “qryTrain”. The filter is to ensure “qryTrain” contains the records where field “BCode” = “SelectedTrain”. This is done with the SQL statement beginning “SQLText = …”
I have submitted three versions of the SQL statement: one live, the other two commented out. The live version containing the string ‘2KXBT5’ (an example of “Selected Train”) works OK, but is hardly practical. I would like to replace the string with the variable “SelectedTrain”, but this returns the error “Table not found in statement [SELECT * FROM tblUnits]”. The other commented-out version is trying to access a “hidden” text box linked to “vwTrain”. This doesn’t work either.
Any ideas? Thanks in advance.Example Code.odt