Crystal Reports & Access 2013 - Continuous Form? - ms-access

Original Question
In Crystal Reports 2011, how do I show all values from a certain Field?
My formula that pulls the data from an Access DB is simply:
{tblQuoteFormSub_Windows.fQty} & " - " &
{tblQuoteFormSub_Windows.fWindowSizeW} &
" x " & {tblQuoteFormSub_Windows.fWindowSizeH}
If I right click on the field in Design or Preview Mode, I can select "Browse Field Data, and see all the values, but I cannot figure out how to print all of them.
EDIT:
I used a sub report (I am still learning, and didn't know they existed in CR until today). Now I can view the records I need based on the fJobID Field.
However...
I need a way to select which group to print... Preferably by using a control in Access to select a Job #. Should I post that as a new question?

The subreport is a good idea. I was thinking of suggesting that, but I wasn't sure if it would have met your needs. I haven't tried Access 2013 yet, and it's been awhile since I've even seen CR. But as for your other question, I can give you one suggestion that I used with previous versions.
In your Access query, add a parameter to your query, i.e. Select * from mytable where job='[Enter Job Num]'. Then when you preview your CR, that parameter should filter through so that it will ask you for the job number when you preview it.
Give it a try and let me know if it worked.

Related

Access Textbox control source outside current report

I am creating a Report in MS Access 2016. I want textboxes showing a summary of data from other tables - without actually showing rows of those tables (no subreports if possible). For example, I have tried to create a textbox with formula
=Format(Avg([WeekData].[DIFOT]),"##0.0%") & " DIFOT This Week"
which should return something like
100% DIFOT This Week
(NB Weekdata is a query and DIFOT is a field in that query, all in the same database as this report.)
However instead it just gives me #Error.
Please can you tell me the most efficient way to pull together summary figures such as these without creating any more queries and/or subreports than absolutely necessary? I'm quite new to SQL and Access on the whole.
Many thanks in advance.
Use DAvg() domain aggregate function. Also, the ## characters in Format() pattern serve no purpose.
=Format(DAvg("DIFOT", "WeekData"), "0.0%") & " DIFOT This Week"
or
=Format(DAvg("DIFOT", "WeekData"), "Percent") & " DIFOT This Week"

How to make sure that MS Access displays the correct subreport data of the current record?

I have a payslip main report with 3 subreports, all are linked through the employee's serialNumber:
rptPayslipPay -for displaying regular pay
rptPSDeds - for displaying deductions
rptPayslipOpay - for displaying supplementary payments. This
subreport is only showed for few selected employees.
I was able to show the total amounts of the 3 subreports on my main report's page footer. Since my last subreport rptPayslipOpay, may or may not have any data, I am displaying it in a text box named [txtOpay] like this:
=IIf([rptPayslipOPay].[Report].[HasData],[rptPayslipOPay].[Report]![sumOpay],"")
My problem is,the value of [txtOpay] shows even if the page has moved on to another employee, thus displaying the previous employee's supplementary payments to the next employee.
Is there a way to prevent this from happening?
Thank you very much.
You might be able to get it to work by fiddling around with the subreports, but assuming a 1:1 relationship between top-level report and subreport, and assuming serialNumber is a string; instead of your IIf statement, you might consider trying something along the lines of:
=DLookup("sumOpay", [rptPayslipOPay].Report.RecordSource, "serialNumber='" & [serialNumber] & "'")
I'm not sure exactly how your objects are named, but I think this should be close to what you're looking for.
By your description, it sounds like "sumOpay" might be a calculated field in the rptPayslipOPay report. If so, you can use:
=DSum("<field containing data to sum>", [rptPayslipOPay].Report.RecordSource, "serialNumber='" & [serialNumber] & "'")
Granted, these will run more slowly, but this might be an easier way to get it to work.
Another option is to left-join rptPayslipOPay's data from in your top-level query, and sum it.

SSRS 2005 Report Preview: Object reference not set to an instance of an object

This is my error and I have read through many of the fixes for this on the site, though none of them seem to address what I am seeing.
I can run my report just fine and the data displays correctly.
My issue is that I am building a hyperlink off of the columns.
I know its one column that is the issue as when I eliminate it from my hyperlink it forms just fine.
My Hyperlink is this:
=Fields!websiteURL.Value & "customer.asp?customerId=" & Iif(Fields!isGuidYN.Value="Y","{","") & Fields!customerId.Value.ToString() & Iif(Fields!isGuidYN.Value="Y","}","") & "&loanId=" & Iif(Fields!isGuidYN.Value="Y","{","") & Fields!loanId.Value.ToString() & Iif(Fields!isGuidYN.Value="Y","}","")
if I eliminate the Fields!loanId.Value.Tostring() the link builds without error (but is no longer useful). Have also tried Fields!loanId.Value.Tostring and Fields!loanId.Value (as this is a string value from the db)
I have tried to hardcode the value from the SQL draw that is that field. 'Test' as loanId and the string comes out fine.
The text box that displays the value on the report is fine and the text is normal on the report. So the data is there, its in the field that displays it, but the hyperlink is not built correctly.
Its just building the Hyperlink gives that error.
The entirety of the error is:
[rsRuntimeErrorInExpression] The Hyperlink expression for the textbox ‘textbox10.ActionInfo.Action’ contains an error: Object reference not set to an instance of an object.
This is not a trickle down error as it is the last one and when I remove the value from the hyperlink the report comes out with 0 errors and 0 warnings.
Any insights would be phenomenal.
Thanks
T
Can you try this expression:
=Fields!websiteURL.Value.ToString() & "customer.asp?customerId=" & Iif(Fields!isGuidYN.Value.ToString()="Y","{","") & Fields!customerId.Value.ToString() & Iif(Fields!isGuidYN.Value.ToString()="Y","}","") & "&loanId=" & Iif(Fields!isGuidYN.Value.ToString()="Y","{","") & Fields!loanId.Value.ToString() & Iif(Fields!isGuidYN.Value.ToString()="Y","}","")
and also make sure that you are using all fields names as it is appearing in dataset. Because in ssrs, names are case sensitive.
OK this wasn't what I was looking for but the report came through when I did something rather foolish..right in that category of "That can't possibly help but let's try it anyways..."
So originally I had a select statement like..
SELECT ...,
loanId,
...
FROM ...
When I ran this I got the loanId but it wouldn't parse the value to a string in order to make it a URL. The value appears in the field on the report, but it doesn't bring it across to the URL.
I even did this:
SELECT ...
'Test' as loanId,
...
FROM ...
That gave me the URL and the report liked it, but of course its not a valid URL for my purposes.
So I wound up doing this and the report likes it, builds the URL and I have no idea why
SELECT ...
loanId,
loanId as loanId2,
...
From ...
Now the report likes both the loanId field and the loanId2 field parses to the URL correctly.
Sure its ugly. But I spent way too much time trying to figure it out

Returning specific field from a matching record

I'm still a newbie at Access 2007, but I feel I am missing a understanding of a concept, when it comes to using user input from an unbound text box.
I'm trying to have the user input the record number (i.e. A12) and return another field in the matching record (such as the record status like "Opened")
I'm fiddling with DLookup to see if it will work through that method but no luck yet.
I may look into SELECT - SQL, but I haven't used that function yet and not sure if that will give me the result I'm looking for.
If this is something elementary to access programming (or databases in general), please let me know where I can read up on this.
I am currently using the MSDN website, but examples go much further to play with.
Edit:
My DLookup so far, which happens after update from user on Text12
Me.Text14.Value = DLookup("[RecordStatus]", "Orders", Text12.Value)
Thanks
Look closer at the third option (Criteria) in your DLookup() expression. You gave it only Text12.Value, which I assume is a string value like "A12".
The Criteria parameter should be like a WHERE clause in a query, without the word WHERE. IOW, some field's value = "A12". If that field is named "record_id", try this:
DLookup("RecordStatus", "Orders", "record_id = '" & Me.Text12 & "'")

Referencing in forms

I have two forms in microsoft access, one called Bill and the other one called Payment. They both have Total amount as a field in both of the forms. I am trying to reference the Bill total amount to the Payment total amount.
I have tried in the Payment total amount control source : =Forms!Bill![Total Amount]
but this doesnt seem to work. In Design view it says '#Name?' in the text box.
How would you do this?
Is either of the forms a subform? If so, you need to reference the subform control or the parent property:
Me.Parent.[Total order]
Me.[Subform Control name Here].form.[Total order]
Note that the Subform Control name is not always the same as the form contained.
EDIT: Either omit Me or use Form!FormName in a control.
EDIT2: Please note that the usual way of referencing forms, subform and controls is with either bang (!) or dot (.). parentheses and quotes are rarely used. This can be seen in both the Microsoft Access MVPs site ( http://www.mvps.org/access/forms/frm0031.htm ) and Microsoft's own site ( http://support.microsoft.com/kb/209099 ), as mentioned by Knox.
If not, have you tried the Expression builder? It will help ensure that you have the correct names.
As an aside, it is best to avoid spaces in the names of fields and controls, it will save you a good deal of work. It is also best to rename controls so they do not have the same name as the fields they contain, txtOrderTotal, for example.
Remou's answer only works in code - however it looks like you are defining the control source of a text box so try this:
=Forms("Bill")![Total order]
My favorite solution is here always to go back to recordsets and calculate corresponding totals, as you are not allways sure that totals at form level are correctly updated (there might always be a pending control/recordset update for any reason). You have then the possibility to use the DSUM and related functions!
Exemple:
dsum(Forms("Bill").recordsource, "unitPrice*lineQuantity")
Of course you could have more complex solutions such as defining a temporary recordset to get your total amount per invoice.
Dim rs as DAO.recordset, _
myBillNumber as variant, _
myBillAmount as variant
set rs = currentDb.openRecordset(_
"SELECT billNumber, sum(unitPrice*lineQuantity) as totalPrice FROM " & _
Forms("Bill").recordset.name " GROUP BY billNumber")
myBillNumber = rs.fields(0)
myBillAmount = rs.fields(1)
It might seem complicated but once you get used to it you'll never hesitate to use it and you'll never ever have the kind of problem you are facing now.