473,402 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Option Button Values and Date Creator Problems on a Report.

48
Hi there,

I have a two problems concerning option button values on a report and data report creator reports.

The situation:

I have three option value boxes two have 3 option and one has only two option buttons. They have values 1, 2, 3. Everything is standard. Now when I create the report, I have only the number for each record on the report, which is kind of ugly and not user-friendly. Is there a chance to turn this values into actual text?

For example. optButton with value 1 should receive Internal.

I have tried to overcome the problem with an iif, doesn't do anything.

Another problem that I have. I have build an "search date creator report". Basically, that tool creates a report when the user types in Start Date and End Date. However, I would like that this report creator also shows Date from to (empty).

Here's the code:
Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub cmdReport_Click()
  3.     On Error GoTo Err_cmdReport_Click
  4.  
  5.     Dim stDocName As String
  6.  
  7.     stDocName = "rptDateParameterReport"
  8.  
  9. 'Check values are entered into Date From and Date To text boxes
  10. 'if so run report or cancel request
  11.  
  12.     If Len(Me.txtdatefrom & vbNullString) = 0 Or Len(Me.txtDateTo & vbNullString) = 0 Then
  13.         MsgBox "Please ensure that a report date range is entered into the form", _
  14.                vbInformation, "Required Data..."
  15.         Exit Sub
  16.     Else
  17.         DoCmd.OpenReport stDocName, acPreview
  18.     End If
  19. Exit_cmdReport_Click:
  20.     Exit Sub
  21.  
  22. Err_cmdReport_Click:
  23.     MsgBox Err.Description
  24.     Resume Exit_cmdReport_Click
  25.  
  26. End Sub
  27.  
I do not see where the vba is actually doing something with the values typed in, except persuing a test if something is in the boxes. Is it even possible to search empty values?

Thanks for the comments and hints.
Aug 21 '07 #1
13 2392
FishVal
2,653 Expert 2GB
Hi there,

I have a two problems concerning option button values on a report and data report creator reports.

The situation:

I have three option value boxes two have 3 option and one has only two option buttons. They have values 1, 2, 3. Everything is standard. Now when I create the report, I have only the number for each record on the report, which is kind of ugly and not user-friendly. Is there a chance to turn this values into actual text?

For example. optButton with value 1 should receive Internal.

I have tried to overcome the problem with an iif, doesn't do anything.

Another problem that I have. I have build an "search date creator report". Basically, that tool creates a report when the user types in Start Date and End Date. However, I would like that this report creator also shows Date from to (empty).

Here's the code:
Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub cmdReport_Click()
  3.     On Error GoTo Err_cmdReport_Click
  4.  
  5.     Dim stDocName As String
  6.  
  7.     stDocName = "rptDateParameterReport"
  8.  
  9. 'Check values are entered into Date From and Date To text boxes
  10. 'if so run report or cancel request
  11.  
  12.     If Len(Me.txtdatefrom & vbNullString) = 0 Or Len(Me.txtDateTo & vbNullString) = 0 Then
  13.         MsgBox "Please ensure that a report date range is entered into the form", _
  14.                vbInformation, "Required Data..."
  15.         Exit Sub
  16.     Else
  17.         DoCmd.OpenReport stDocName, acPreview
  18.     End If
  19. Exit_cmdReport_Click:
  20.     Exit Sub
  21.  
  22. Err_cmdReport_Click:
  23.     MsgBox Err.Description
  24.     Resume Exit_cmdReport_Click
  25.  
  26. End Sub
  27.  
I do not see where the vba is actually doing something with the values typed in, except persuing a test if something is in the boxes. Is it even possible to search empty values?

Thanks for the comments and hints.
Hi, Sacha.

I guess the OptionGroup control is bound to some field in a table where it stores numerical values. You need to build a table

tblOptions
keyOptionID Long, PK (OptionGroup.Value)
txtOption Text (Text to replace OptionGroupValue)

fill the table with an appropriate Number-Text couples
build a query based on rptDateParameterReport.RecordSource table/query to tblOptions join and set the query to rptDateParameterReport.RecordSource.

Now you can set ControlSource of a correspondent control in rptDateParameterReport to tblOptions.txtOption

Good luck.
Aug 21 '07 #2
alive84
48
Hi, Sacha.

I guess the OptionGroup control is bound to some field in a table where it stores numerical values. You need to build a table

tblOptions
keyOptionID Long, PK (OptionGroup.Value)
txtOption Text (Text to replace OptionGroupValue)

fill the table with an appropriate Number-Text couples
build a query based on rptDateParameterReport.RecordSource table/query to tblOptions join and set the query to rptDateParameterReport.RecordSource.

Now you can set ControlSource of a correspondent control in rptDateParameterReport to tblOptions.txtOption

Good luck.
Once again, thanks to your help, I solved the first problem.

do you know, how I could change this WHERE part of my SQL-Query, so that it is optional to use "Date to"?

Expand|Select|Wrap|Line Numbers
  1. (((tblWork.StartDate)>=forms!frmReportDate!txtDateFrom) And ((tblWork.EndDate)<=forms!frmReportDate!txtDateTo));
  2.  
thanks,
Aug 21 '07 #3
FishVal
2,653 Expert 2GB
Once again, thanks to your help, I solved the first problem.

do you know, how I could change this WHERE part of my SQL-Query, so that it is optional to use "Date to"?

Expand|Select|Wrap|Line Numbers
  1. (((tblWork.StartDate)>=forms!frmReportDate!txtDateFrom) And ((tblWork.EndDate)<=forms!frmReportDate!txtDateTo));
  2.  
thanks,
Expand|Select|Wrap|Line Numbers
  1. (((tblWork.StartDate)>=forms!frmReportDate!txtDateFrom) And ((tblWork.EndDate)<=forms!frmReportDate!txtDateTo) OR IsNull(forms!frmReportDate!txtDateTo));
  2.  
Did you mean this?
Aug 21 '07 #4
alive84
48
Expand|Select|Wrap|Line Numbers
  1. (((tblWork.StartDate)>=forms!frmReportDate!txtDateFrom) And ((tblWork.EndDate)<=forms!frmReportDate!txtDateTo) OR IsNull(forms!frmReportDate!txtDateTo));
  2.  
Did you mean this?
Unfortunately not, because like that it shows me all records in the table. thanks
Aug 21 '07 #5
FishVal
2,653 Expert 2GB
Unfortunately not, because like that it shows me all records in the table. thanks
It shows all records from DateFrom if DateTo was not entered.
If this is not what you've wanted, then please clarify what you've meant saying
how I could change this WHERE part of my SQL-Query, so that it is optional to use "Date to"?
Aug 21 '07 #6
alive84
48
It shows all records from DateFrom if DateTo was not entered.
If this is not what you've wanted, then please clarify what you've meant saying
Sorry, I mean that I could search all DateFrom without setting a DateTo, but it should also be possible to set a DateTo (if wanted). Both choices should be possible.

For example: I set DateFrom as 01.01.2007 Empty DateTo, and it shows me now all records where DateFrom is >01.01.2007 with an empty DateTo.
But it should also be possible when I give this input: DateFrom 01.01.2007 and DateTo 01.09.2007
Aug 21 '07 #7
FishVal
2,653 Expert 2GB
Sorry, I mean that I could search all DateFrom without setting a DateTo, but it should also be possible to set a DateTo (if wanted). Both choices should be possible.

For example: I set DateFrom as 01.01.2007 Empty DateTo, and it shows me now all records where DateFrom is >01.01.2007 with an empty DateTo.
But it should also be possible when I give this input: DateFrom 01.01.2007 and DateTo 01.09.2007
So what is wrong with the criteria I've previously posted.
Here I've removed unnecessary brackets.
Expand|Select|Wrap|Line Numbers
  1. tblWork.StartDate>=forms!frmReportDate!txtDateFrom And (tblWork.EndDate<=forms!frmReportDate!txtDateTo OR IsNull(forms!frmReportDate!txtDateTo));
Aug 21 '07 #8
alive84
48
So what is wrong with the criteria I've previously posted.
Here I've removed unnecessary brackets.
Expand|Select|Wrap|Line Numbers
  1. tblWork.StartDate>=forms!frmReportDate!txtDateFrom And (tblWork.EndDate<=forms!frmReportDate!txtDateTo OR IsNull(forms!frmReportDate!txtDateTo));

the problem is that it shows me even Dates before 01.01.2007 when I am not entering anything in DateTo. However, when I enter a DateTo it shows me all records, where there is a DateTo in the Table. It would be neat, if it also shows me all records with DateFrom 01.01.2007 with an empty DateTo.

I have played around with the WHERE statement you gave me...but no solution yet.

thanks
Aug 21 '07 #9
FishVal
2,653 Expert 2GB
the problem is that it shows me even Dates before 01.01.2007 when I am not entering anything in DateTo. However, when I enter an DateTo it shows me all records, where there is a DateTo in the Table. It would be neat, if it also shows me all records with DateFrom 01.01.2007 with an empty DateTo.

I have played around with the WHERE statement you gave me...but no solution yet.

thanks
Post the whole SQL expression.
Aug 21 '07 #10
alive84
48
Post the whole SQL expression.
Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT tblContacts.FirstName, tblContacts.LastName, tblCostCenter.CostCenter, tblCostCenter.OrgUnit, tblCostCenter.Region, tblWorkstream.Workstream, tblWorkstream.[Cap/Non-Cap], tblWork.EndDate, tblWork.StartDate, tblWork.[Int/Ext], tblWork.FTE, tblWork.[Fix/T&M], tblWork.[TSU/NLA], tblVendor.Vendor, tblContacts.ContactID, tblOptionValueIntExt.Text, tblOptionValueNLA.Text, tblOptionValueFix.Text
  3. FROM tblContacts, tblWorkstream, tblWork, tblCostCenter, tblVendor, tblOptionValueIntExt, tblOptionValueNLA, tblOptionValueFix
  4. WHERE (tblContacts.ContactID=tblWork.ContactID) And (tblCostCenter.CostCenterID=tblWork.CostCenterID) And (tblWorkstream.WorkstreamID=tblWork.WorkstreamID) And (tblVendor.VendorID=tblWork.VendorID) And (tblOptionValueIntExt.OptionValueIntExtID=tblWork.[Int/Ext]) And (tblOptionValueNLA.OptionValueNLAID=tblWork.[TSU/NLA]) And (tblOptionValueFix.OptionValueFIXID=tblWork.[Fix/T&M]) And ((tblWork.StartDate)>=forms!frmReportDate!txtDateFrom And (tblWork.EndDate)<=forms!frmReportDate!txtDateTo OR IsNull(forms!frmReportDate!txtDateTo));
  5.  
  6.  
Aug 21 '07 #11
FishVal
2,653 Expert 2GB
Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT tblContacts.FirstName, tblContacts.LastName, tblCostCenter.CostCenter, tblCostCenter.OrgUnit, tblCostCenter.Region, tblWorkstream.Workstream, tblWorkstream.[Cap/Non-Cap], tblWork.EndDate, tblWork.StartDate, tblWork.[Int/Ext], tblWork.FTE, tblWork.[Fix/T&M], tblWork.[TSU/NLA], tblVendor.Vendor, tblContacts.ContactID, tblOptionValueIntExt.Text, tblOptionValueNLA.Text, tblOptionValueFix.Text
  3. FROM tblContacts, tblWorkstream, tblWork, tblCostCenter, tblVendor, tblOptionValueIntExt, tblOptionValueNLA, tblOptionValueFix
  4. WHERE (tblContacts.ContactID=tblWork.ContactID) And (tblCostCenter.CostCenterID=tblWork.CostCenterID) And (tblWorkstream.WorkstreamID=tblWork.WorkstreamID) And (tblVendor.VendorID=tblWork.VendorID) And (tblOptionValueIntExt.OptionValueIntExtID=tblWork.[Int/Ext]) And (tblOptionValueNLA.OptionValueNLAID=tblWork.[TSU/NLA]) And (tblOptionValueFix.OptionValueFIXID=tblWork.[Fix/T&M]) And ((tblWork.StartDate)>=forms!frmReportDate!txtDateFrom And (tblWork.EndDate)<=forms!frmReportDate!txtDateTo OR IsNull(forms!frmReportDate!txtDateTo));
  5.  
  6.  
Exactly what I have thought. Pay attention to criteria logic. It should evaluates to True if (tblWork.StartDate)>=forms!frmReportDate!txtDateFr om evaluates to True, and (tblWork.EndDate)<=forms!frmReportDate!txtDateTo OR IsNull(forms!frmReportDate!txtDateTo) evaluates to true. Since AND has higher preference than OR, the latter should be enclosed in brackets. Hope you see them in bold and underlined.
Expand|Select|Wrap|Line Numbers
  1. SELECT tblContacts.FirstName, tblContacts.LastName, tblCostCenter.CostCenter, tblCostCenter.OrgUnit, tblCostCenter.Region, tblWorkstream.Workstream, tblWorkstream.[Cap/Non-Cap], tblWork.EndDate, tblWork.StartDate, tblWork.[Int/Ext], tblWork.FTE, tblWork.[Fix/T&M], tblWork.[TSU/NLA], tblVendor.Vendor, tblContacts.ContactID, tblOptionValueIntExt.Text, tblOptionValueNLA.Text, tblOptionValueFix.Text
  2. FROM tblContacts, tblWorkstream, tblWork, tblCostCenter, tblVendor, tblOptionValueIntExt, tblOptionValueNLA, tblOptionValueFix
  3. WHERE (tblContacts.ContactID=tblWork.ContactID) And (tblCostCenter.CostCenterID=tblWork.CostCenterID) And (tblWorkstream.WorkstreamID=tblWork.WorkstreamID) And (tblVendor.VendorID=tblWork.VendorID) And (tblOptionValueIntExt.OptionValueIntExtID=tblWork.[Int/Ext]) And (tblOptionValueNLA.OptionValueNLAID=tblWork.[TSU/NLA]) And (tblOptionValueFix.OptionValueFIXID=tblWork.[Fix/T&M]) And ((tblWork.StartDate)>=forms!frmReportDate!txtDateFrom And ((tblWork.EndDate)<=forms!frmReportDate!txtDateTo OR IsNull(forms!frmReportDate!txtDateTo)));
  4.  
Compare these math expressions:
2*3+1
2*(3+1)
Aug 21 '07 #12
alive84
48
Exactly what I have thought. Pay attention to criteria logic. It should evaluates to True if (tblWork.StartDate)>=forms!frmReportDate!txtDateFr om evaluates to True, and (tblWork.EndDate)<=forms!frmReportDate!txtDateTo OR IsNull(forms!frmReportDate!txtDateTo) evaluates to true. Since AND has higher preference than OR, the latter should be enclosed in brackets. Hope you see them in bold and underlined.
Expand|Select|Wrap|Line Numbers
  1. SELECT tblContacts.FirstName, tblContacts.LastName, tblCostCenter.CostCenter, tblCostCenter.OrgUnit, tblCostCenter.Region, tblWorkstream.Workstream, tblWorkstream.[Cap/Non-Cap], tblWork.EndDate, tblWork.StartDate, tblWork.[Int/Ext], tblWork.FTE, tblWork.[Fix/T&M], tblWork.[TSU/NLA], tblVendor.Vendor, tblContacts.ContactID, tblOptionValueIntExt.Text, tblOptionValueNLA.Text, tblOptionValueFix.Text
  2. FROM tblContacts, tblWorkstream, tblWork, tblCostCenter, tblVendor, tblOptionValueIntExt, tblOptionValueNLA, tblOptionValueFix
  3. WHERE (tblContacts.ContactID=tblWork.ContactID) And (tblCostCenter.CostCenterID=tblWork.CostCenterID) And (tblWorkstream.WorkstreamID=tblWork.WorkstreamID) And (tblVendor.VendorID=tblWork.VendorID) And (tblOptionValueIntExt.OptionValueIntExtID=tblWork.[Int/Ext]) And (tblOptionValueNLA.OptionValueNLAID=tblWork.[TSU/NLA]) And (tblOptionValueFix.OptionValueFIXID=tblWork.[Fix/T&M]) And ((tblWork.StartDate)>=forms!frmReportDate!txtDateFrom And ((tblWork.EndDate)<=forms!frmReportDate!txtDateTo OR IsNull(forms!frmReportDate!txtDateTo)));
  4.  
Compare these math expressions:
2*3+1
2*(3+1)

Oooo my god, I didn't know that SQL has this logic too, gosh...I am sorry, but that's now also something I will never ever forget. Thanks, its now working superb.
Aug 21 '07 #13
FishVal
2,653 Expert 2GB
Oooo my god, I didn't know that SQL has this logic too, gosh...I am sorry, but that's now also something I will never ever forget. Thanks, its now working superb.
The rules of Boolean algebra were postulated by George Boole in smnthng like 1848, much before SQL. :)
Boolean algebra (logic)
You are welcome.
Aug 21 '07 #14

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Melissa | last post by:
What is the code to delete a command button from a form? Can the code be run from the click event of the button to be deleted? Thanks! Melissa
12
by: Diego | last post by:
Can I validate (possibly with a compare validator) a Date entered by the user based upon his regional settings? I.e. if a user is american the format would be mm/dd/yyyy, if brittish dd/mm/yyyy...
2
by: NishSF | last post by:
Would anyone have any suggestions/javascript code so that if one clicks the Radio Button "Yes" below he has the option of selecting any of the six CheckBox below. If the user clicks on Radio Button...
16
by: TetoPR | last post by:
Hi, I'm trying to set up an Option Box in a form to feed a Parameter Query to be used as a filter. That field I want to filter is a Text field and has two posible values: "A" and "B". So my Option...
0
by: aakash | last post by:
Hello Guys I am upsizing ms access project to give it a ms sql connectivity I am having problem in accessing form control values in ms sql function CREATE FUNCTION "ReportList DateRange"() ...
1
by: Intrepid_Yellow | last post by:
Hi, I have the following code that runs my report generator. The user selects a table from a combo box, then whatever fields they want from a list box. (This part all works and the report runs...
6
by: ladybug76 | last post by:
Hello. Okay, so I have an Option Group with 6 reports on the Right hand side of a form. On the left, I have 4 command buttons. 1) Preview 2) Print 3) Save off 4) Email. I want the user to be...
2
by: sara | last post by:
Hi I'm having a very strange problem and need HELP!! I have a form for the user to choose a report (radio button in an option group) and parameters (Dates, Season). Click the option button,...
25
smithj14
by: smithj14 | last post by:
I have a form that has an option group (fraReports) which holds a list of reports to print. This part works fine. I select a report name and click print and that report opens. Now I want to add a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.