Hey there folks, got a bit of an odd question here, wondering if you could help out. Recently I've been writing an application in Access, and one of the things it was requested to be able to do is automatically generate a letter to be printed out and mailed to a recipient based on some database information. I decided to use reports to do this, basically creating a single huge blank textbox and populating it with the letter and its associated variables during the onload event. It seems to work fairly well for the most part, but I've run into a couple of snags.
The biggest one is one of the variables. It's a combo box, with three different possible values - Junked, Abandoned, or Nuisance. Now, when I create the report using the report wizard, I can see the combo box pop up clearly, and it has the right value selected and everything. When I try to get at this value in VBA to put it in the letter, however, things go wrong.
I actually have the combo box on the page and I pull the data from there, I just mark it hidden. This works fine for all my other various text fields, but any time I try it on a combo box like so...
MyString = MyString & Me.status_box
where status_box is the name of the combo box, it seems to retrieve the integer ID rather than the text value. Trying to use Me.status_box.Text or Me.status_box.value doesn't work either, as Access complains about status_box not having focus for the Text method and just continues to give an integer for the Value method. Is there a way for me to retrieve the selected text from the combo box? Whenever I temporarily mark it as visible again, I can see that it DOES have the correct value selected there. I just can't get to it in VBA.
I'm very close on completing this project, this is my last major roadblock. Any help you could give would be much appreciated. Thanks!
The biggest one is one of the variables. It's a combo box, with three different possible values - Junked, Abandoned, or Nuisance. Now, when I create the report using the report wizard, I can see the combo box pop up clearly, and it has the right value selected and everything. When I try to get at this value in VBA to put it in the letter, however, things go wrong.
I actually have the combo box on the page and I pull the data from there, I just mark it hidden. This works fine for all my other various text fields, but any time I try it on a combo box like so...
MyString = MyString & Me.status_box
where status_box is the name of the combo box, it seems to retrieve the integer ID rather than the text value. Trying to use Me.status_box.Text or Me.status_box.value doesn't work either, as Access complains about status_box not having focus for the Text method and just continues to give an integer for the Value method. Is there a way for me to retrieve the selected text from the combo box? Whenever I temporarily mark it as visible again, I can see that it DOES have the correct value selected there. I just can't get to it in VBA.
I'm very close on completing this project, this is my last major roadblock. Any help you could give would be much appreciated. Thanks!