Populate a Textbox from a lookup
I have a textbox (TextBox81) that I would like to populate with the results from an auto-lookup.
The Auto-lookup works properly when formatted as:
SELECT Code as Name, Code as Value FROM myTable WHERE BU='Brakes'
Validates
According to another article I should use the textbox ID and set it to the alias:
SELECT Code as TextBox81, Code as Value FROM myTable WHERE BU='Brakes'
Does not Validate
What is the proper way to populate a textbox?
-
Hi Paul,
If you are populating the auto-lookup result to a combo box then the query you provided works and if you want to populate it to some other control other than combo box then you should not use the NAME/VALUE pair in query.
You can use below query in your case to populate the value to the textbox:
SELECT Code As TextBox81 FROM myTable WHERE BU='Brakes'
Thanks
-
Thank you! The auto-lookup works perfectly in my subform.
I am now trying to do the same thing on the primary form using a Department dropdown (DeptDB) and a Department Description *(DeptDesc) textbox. The lookup tests properly and returns data.
As I diagnose, I have hardcoded the WHERE='0015' to ensure I'm getting a result.
When I change the value in the department dropdown, the autolookup is triggered and properly populates the department description with the result from the hardcoded query. so everything seems to work properly.
When I change the query to use the new Department value ('DeptDB') I am not getting a populated Department Description. Is there a log I can look at to see what sql command is being executed when i'm in the dev/PC browser view?
I have the autolookup trigger by a change in a specific value. But it d
請登入寫評論。
評論
4 條評論