Link to home
Start Free TrialLog in
Avatar of Jenkins
JenkinsFlag for United States of America

asked on

Display results of a query in a textbox

I've attached an Access database.   When you open the database, please open the form. You'll see 3 comboboxes.  Select the following values from the comboboxes:

combobox1 :    AAAA
combobox2:     1111
combobox3:     F

You'll see the subform gets populated with the value $850.   How do I populate the textbox with that value? I want to use a textbox to display the result instead of a subform. I DO NOT WANT TO USE DLOOKUP TO DO IT.  DLookup always has a noticeable delay in displaying a result and I can't stand it.  

Another question: Going back to the subform, why does my merely changing the default view from Datasheet to Single Form cause the database to fail?  Even if I try to then change it back to Datasheet view without having made any other changes whatsoever, it still fails. Can somebody explain why?  Thank you.
TEST1-1.mdb
Avatar of mbizup
mbizup
Flag of Kazakhstan image

If you like the 'speed' of the subform approach, how about hiding the subform and adding to the combo's After Update event:

Private Sub ComboBox3_AfterUpdate()
Me.Current_Balance_sub.Requery
Me.txtGetResult = Me.Current_Balance_sub.Form.[current balance]


End Sub

Open in new window

Avatar of Jenkins

ASKER

It's not that I like the speed of the subfrom approach. I'm just using a solution someone provided to me previously; but he put it in a subform instead of a textbox. When using a textbox, the only working answer (other than hardcoding the query in a module which I've since been advised against) I've gotten so far is DLookup and I hate DLookup. Every time I use DLookup for anything, there's a noticeable delay in the control being populated and it makes the form look very unprofessional.   All I want is for the result of the query to be displayed in a textbox....but not using DLookup.
Avatar of Jenkins

ASKER

And by the way, if you can get the subform or any other type of control to LOOK like a textbox if it's easier to put the result in that type of control instead of an actual textbox, then that's fine. That's why I asked about changing the subform's view from datasheet to single form. That was my attempt to make the subform look like a textbox. However, when I changed the view of the subform, the query would no longer work. Not even when I changed back to datasheet view. Datasheet view looks horrible for this application. I need the output to be put in something that looks like a textbox. Thank you.
Okay - hiding the subform and populating a textbox would give you the appearance you're looking for, but I think your idea of disguising the subform if possible is better all around.

That may be doable in Single Form view by playing with the subform border, navigation buttons, etc.
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
https://www.experts-exchange.com/questions/27712424/Display-query-results-in-a-textbox.html

And a lot of your other recent questions seem eerily similar...

Again, just curious as to why this one interface generates so many questions and different answers...?

Perhaps I am not seeing the differences between them...?

Jeff