Display some information from query in pop up window

MattWhiteley

Registered User.
Local time
Today, 01:19
Joined
Jun 10, 2015
Messages
16
Hello, to give as brief of an overview of the situation as possible, I've created a query called "JobHistoryQuery" and a form called "JobHistoryMultiForm", this displays all Jobs related to an Asset and all the information about that job. There are some fields (BilledMonth, BilledYear, BilledValue, Parts Required, PartsUsed), however, that I would only like to see if I need to see them (as there is quite a lot of information on the form and ideally, I'd like to be able to see the key information from each job from that asset with ease). What I would like is to create a button that says "Billing" and "Parts" for each job and it brings up a pop up window displaying that information.

How would I go about doing this?

Thanks in advance.
 
One way:

LINK
Thanks, I've just got back to building this database after a few busy days so I'm still stuck at this point.

I've created a label Command63, a second form "PartsPopUp" which is the same as the original form except I've only got the Parts Required and Parts Used fields on display. Here's the code I have so far for Command63

Code:
Private Sub Command63_Click()
DoCmd.OpenForm "PartsPopUp", , , "VisitID = " & Me.ControlName
End Sub
I'm not sure what I need to put in place of Me.ControlName. Forgive me, I'm only just learning VBA and essentially I'm learning it as I go along in this project.
 
ControlName would be replaced by the name of the textbox or other control that contains the VisitID you want the second form filtered to.
 
Thanks, like a first class pillock I was setting it to the Command63 which I've just realised makes no sense now that you've explained that. Cheers!
 
Okay, I realised I was doing it wrong. I actually should have been putting something like this in:

Code:
Private Sub Command63_Click()
DoCmd.OpenForm "PartsPopUp", , , "Parts_Required = '" & Me.Parts_RequiredBox & "'"
End Sub
But that returns the error:

"Run-time error '3831':

The multi-valued field "Parts_Required" cannot be used in a WHERE or HAVING clause."

Edit: I'd also like to have Parts_Used in the same pop-up but if that's too complex, I'm cool with having two separate pop-up windows.
Edit: To save confusion I've edited the control to be Parts_RequiredBox
 
Sorry, I have no experience with multi-value fields (like many/most experienced developers, don't like them, won't use them). I'm not sure you can do this type of thing with a multi-value field, but I'll poke around.
 
Ah right, thanks. Guess I'll just have to put up with that then. In the meantime I've tried doing it with my Billing information instead.

Code:
Private Sub Command66_Click()
DoCmd.OpenForm "BillingPopUp", , , "Billed_Month = '" & Me.Billed_MonthBox & "'"
End Sub
And it returns "Compile Error: Method or data member not found"

Any idea why? Bearing in mind that I'm a complete amateur with VBA, so it's probably something stupidly obvious.
 
The error would imply that "Billed_MonthBox" is not the name of a control on the form. Or perhaps "Billed_Month" isn't the name of the field. Perhaps there are inadvisable spaces rather than underscores? Can you post the db here?
 
I've solved that now I thought I'd renamed it to Billed_MonthBox but seemingly not, it was still Billed_Month. It isn't showing the specified record though, it's showing all the records from the query parameters.

Edit: Scratch that actually, it works better as a continous form anyway for billing so I can see the full history
 

Attachments

Last edited:
Not sure how to test, but if I just hit enter on the parameter prompt for Charger ID that comes up when I open the form, find a record where the billed month field has something in it, hit the Billing button, hit enter on the parameter prompt, I get 2 records, both with June as the billed month.
 

Users who are viewing this thread

Back
Top Bottom