L
Lant
Using Visio 2003 and VBA 6.3
I am trying to populate a Textbox (TextBoxPackageInfo) based on the user
selection made in a ComboBox (the selection is stored in a public variable-
ThisDocument.packageSelection ) on the same form (FormPackageSelection). I
have the following code in the CHANGE event of the combobox. The code works
but seems to be taking a long time to go thru the loop (shown in the code
below) and
refresh the Text box when an update is made. I am new to VBA, Data Access
Object, and Visio. Please provide feedback on any wrong approaches you see in
this code which could fix the problem.
===================================================================================================
strSelect = "SELECT DISTINCT productname FROM prodtable WHERE packagename=
'" &
ThisDocument.packageSelection & "';"
'Open the Details table (Record Set)
Set rsDetails = ThisDocument.db.OpenRecordset(strSelect)
'Populate the Package Details from the record set
FormPackageSelection.TextBoxPackageInfo.Text = " "
tempString = " "
Do Until rsPackageDetails.EOF
tempString = tempString & Trim(rsPackageDetails!ProductName) & vbCrLf &
" "
rsPackageDetails.MoveNext
Loop
FormPackageSelection.TextBoxPackageInfo.Text = tempString
=====================================================
I am trying to populate a Textbox (TextBoxPackageInfo) based on the user
selection made in a ComboBox (the selection is stored in a public variable-
ThisDocument.packageSelection ) on the same form (FormPackageSelection). I
have the following code in the CHANGE event of the combobox. The code works
but seems to be taking a long time to go thru the loop (shown in the code
below) and
refresh the Text box when an update is made. I am new to VBA, Data Access
Object, and Visio. Please provide feedback on any wrong approaches you see in
this code which could fix the problem.
===================================================================================================
strSelect = "SELECT DISTINCT productname FROM prodtable WHERE packagename=
'" &
ThisDocument.packageSelection & "';"
'Open the Details table (Record Set)
Set rsDetails = ThisDocument.db.OpenRecordset(strSelect)
'Populate the Package Details from the record set
FormPackageSelection.TextBoxPackageInfo.Text = " "
tempString = " "
Do Until rsPackageDetails.EOF
tempString = tempString & Trim(rsPackageDetails!ProductName) & vbCrLf &
" "
rsPackageDetails.MoveNext
Loop
FormPackageSelection.TextBoxPackageInfo.Text = tempString
=====================================================