Avatar of Jenkins
Flag 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.
Microsoft Access

Avatar of undefined
Last Comment
Jeffrey Coachman

8/22/2022 - Mon

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.txtGetResult = Me.Current_Balance_sub.Form.[current balance]

End Sub

Open in new window


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.

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.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes

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.

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Jeffrey Coachman


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...?