Populate a text box from a list and update a second list from the result
Hello Experts,
I have been working on this for two days and haven't been able to get a result.
We have a form with two list boxes (lstEntities and lstPrincipalHospitals and a text box (txtABNID). When the form is current, lstEntities and lstPrincipalHospitals are populated by select queries from tables REFProviderRegister and VendorDetails which have a 1 to many relationship on ProviderID.
What is required is that with the OnClick event in lstEntities, txtABNID is updated from lstEntities.Column(1) and lstPrincipalHospitals should update with the details of the hospital names where ABN = txtABNID.
Everything works when the form is current, however when the lstEntities is clicked, lstPrincipalHospitals goes blank (no data at all).
Could you please peruse the code and suggest how this might be remedied?
>> To get it to work I had to enclose it in single-quotes as well.
Glad you've got this resolved.
I'm not sure if you noticed it or not but you actually made another correction in the code you posted that I didn't spot last night. There was an exraneous closing parenthesis ( ")") which you removed in the code you posted. I'm pretty sure that is what was causing you grief.
Just a word of caution with the single-quote syntax - it should be fine for your ABN ID field, but will cause problems with data such as Names where values containing single quotes (eg: Irish names like O'Brien) will produce errors.
JOHN_STIBBARD
ASKER
Thanks mbizup, will keep the name comment in mind.
Cheers
John
Verify that you indeed should be using Column 1
Note that column indexes are zero-based (ie: the count starts at zero, not 1) and generally ID fields are in column zero.