Need help Passing data (1 Viewer)

MiscAlma

Registered User.
Local time
Yesterday, 19:03
Joined
Jul 11, 2019
Messages
11
I need help trying to get a certain query to run only after I put a start and
End Date and only if i press the complete KPI button and the query is the one at the bottom and I was wondering how to do I manage it?




SELECT Sum(qrySLBU12Hours.APPLIED_RESOURCE_UNITS) AS SumOfAPPLIED_RESOURCE_UNITS
FROM qrySLBU12Hours;
 

Attachments

  • help1.png
    help1.png
    11.6 KB · Views: 24

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 19:03
Joined
Oct 29, 2018
Messages
21,467
What is the code behind your "Complete KPI" button? You could modify it to check for required entries.
 

MiscAlma

Registered User.
Local time
Yesterday, 19:03
Joined
Jul 11, 2019
Messages
11
What is the code behind your "Complete KPI" button? You could modify it to check for required entries.



Private Sub Command90_Click()

Date1 = "#" & Now - 200 & "#"
Date2 = "#" & Now & "#"

StartDate = "#" & Text0.Value & "#"
If StartDate = "##" Then GoTo ErrorMsg
If Text2.Value = Null Then GoTo ErrorMsg
EndDate = "#" & Text2.Value & "#"
If EndDate = "##" Then GoTo ErrorMsg

ErrorMsg:
msg1 = MsgBox("Enter a valid date range", vbOKOnly)
Exit Sub

End Sub

the code was written before my time I find it hard to understand, and I want to use forms to get the work done, mainly because I dont understand VBA for applications.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 19:03
Joined
Oct 29, 2018
Messages
21,467
the code was written before my time I find it hard to understand, and I want to use forms to get the work done, mainly because I dont understand VBA for applications.
Hi. Understanding VBA would come with exposure and practice. I suggest not trying to avoid it, because it can enhance your abilities later on.
Okay, so, to check if an entry has been made or not, you can use an If/Then statement. For example,
Code:
If Me.Text0 & "" = "" Then
    MsgBox "Please enter a start date."
Else
    'the rest of your code here
End If
That's just a sample. We obviously need to add the one for end date as well, but let's start with that.
 

MiscAlma

Registered User.
Local time
Yesterday, 19:03
Joined
Jul 11, 2019
Messages
11
I decided to take your advice and i Just jumped into the code and kept experimenting with it until i got it to work. Its displaying information from another query But Ill manage to get it to work.

I appreciate your professional Advice
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 19:03
Joined
Oct 29, 2018
Messages
21,467
I decided to take your advice and i Just jumped into the code and kept experimenting with it until i got it to work. Its displaying information from another query But Ill manage to get it to work.

I appreciate your professional Advice
Hi. Congratulations! Glad to hear you got it to work. Good luck with your project.
 

Users who are viewing this thread

Top Bottom