Display results of a query in a textbox

dbfromnewjersey
dbfromnewjersey used Ask the Experts™
on
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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
mbizupNerd
Most Valuable Expert 2012
Top Expert 2013

Commented:
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

Author

Commented:
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.

Author

Commented:
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.
Acronis in Gartner 2019 MQ for datacenter backup

It is an honor to be featured in Gartner 2019 Magic Quadrant for Datacenter Backup and Recovery Solutions. Gartner’s MQ sets a high standard and earning a place on their grid is a great affirmation that Acronis is delivering on our mission to protect all data, apps, and systems.

mbizupNerd
Most Valuable Expert 2012
Top Expert 2013

Commented:
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.
Nerd
Most Valuable Expert 2012
Top Expert 2013
Commented:
You were actually fairly close - you need to set the background of the subform's detail section to look like the main form.

Check this out... the textbox formatting should also be adjusted to match the controls on your main form.
TEST1-1.mdb
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012
Commented:
dbfromnewjersey,

Nothing personal, and I am just curious...
...but you seem to be re-hashing the same basic question...
Am I missing something?
I thought i answered this Q a while ago?
(use aggregate functions instead of the complex "SQL in code" you were originally attempting)

What is the ultimate goal here?
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

Commented:
http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_27712424.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

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial