SSRS not recognizing dataset in expression for barcode - reporting-services

Whenever I use this code
=IIf(JPCI_RPT_ReceiptStatusHeaderBLW.RECEIPT_ID_TYPE = "Trailer ID",
Code.StringToBarcode({JPCI_RPT_ReceiptStatusHeaderBLW.trailer_id}),
Code.StringToBarcode({JPCI_RPT_ReceiptStatusHeaderBLW.receipt_id_type}) & chr(10) &
Code.StringToBarcode({JPCI_RPT_ReceiptStatusDetailsBLW.item})
I get the following error...
Name 'JPCI_RPT_ReceiptStatusHeaderBLW' is not declared.
It's checking for dataset right? If not, how do I declare it?

The expression is looking for a field name and you're converting something like Crystal Reports to SSRS. In SSRS you refer to a field value with Fields!FieldName.Value.
Assumeing that you have a dataset with necessary fields, your expression would be something like:
=IIF(Fields!RECEIPT_ID_TYPE.Value = "Trailer ID",
Code.StringToBarcode(Fields!trailer_id.Value),
Code.StringToBarcode(Fields!receipt_id_type.Value) & chr(10) &
Code.StringToBarcode(Fields!item.Value) )
You had missed a closing parenthesis as well, but the error check didn't get that far.

Related

MS access Query with in and parameter

I need to create a query in MS access where the parameter is a list (given by me).
This works In ("2209487";"2102669";"2727930";"3727550"), but if I try to put a parameter inside the "IN" like this: In ([NUM]) It doesn't return a result!
I write 2209487";"2102669";"2727930";"3727550 when the parameter window appears.
PS: my laptop is in European Portuguese so I use the ";"
You can't use a "list" or "multiple" values for this. But you CAN do this in the where clause of hte form (or report).
First, remove any paramters for the form/report. You want to be able to open/launch the form/report WITHOUT any prompts from the query. In fact, what follows will even work if you based the form/report directly on the table.
So, you can do this:
dim strInvoices as string
strInvoices = InputBox("Enter invoice numbers ',' between each")
dim strWhere as string
strWhere = "InvoiceNumber in (" & strInvoices & ")"
docmd.OpenReport "frmInvoices",,,strWhere
So, you can provide a list as per above and use the "in"
the IN clause is this
InvoiceNumber in (234,433,555)
So, you can pass the conditions as a "where" clause to a open form or report.
Thanks to all!!!!
i've redone the query and logic of the database) in another way.

How to evaluate an expression in Access like evaluating a formula in excel

Is there a way to evaluate an expression in Access like we can evaluate formulae in Excel? My Dlookup keeps resulting in the number two and I can't figure out where the hang up is.
=Nz(DLookUp("[RemanChangePoint]![ID]","[RemanChangePoint]","[NewPartNum] Like '*" & [LegacyPN1] & "*' Or [NewPartNum] Like '*" & [LegacyPN2] & "*'"),"")
There's 10 more LegacyPNs and I am expecting to get either the ID of the record that has the LegacyPN or a blank. Before, instead of doing it as above, I was doing:
Like & Chr(34) & "*" & [LegacyPN#] & "*" & Chr(34) & " Or..."
It would result in 2 every time. But now with the shortened version, it's resulting in blanks every time, even though there are records with the part number.
I have a similar expression on a different form, but only one LegacyPN to use as the lookup so it works. I assume that the problem is the numerous Or statements, but it doesn't make sense to me why it's not working, thus the desire for an expression evaluator like Excel has.
Or (and this may be a little uncouth to ask a slightly different question)
Is there a way to use an attachment's file name as the criteria for Dlookup? That may prove more effective than going by LegacyPN, I just can't figure it out via the expression builder.
Your first DLookup where clause is referring to fields on the current form since the double quotes cause the expression to break out of the where clause and into the scope of the ControlSource.
This means something like the following will be passed into the DLookup function because the [LegacyPN] portions of the expression are evaluated in the context of the form, before DLookup is called:
[NewPartNum] Like '*1*' Or [NewPartNum] Like '*2*'
...where 1 and 2 are values of [LegacyPN1] and [LegacyPN2] on the current form.
If you want the [LegacyPN] fields in the DLookup where clause to refer to the [RemanChangePoint] table being queried by the DLookup, then you need to fix your quotes:
=Nz(DLookUp("[RemanChangePoint]![ID]","[RemanChangePoint]", "[NewPartNum] Like '*' & [LegacyPN1] & '*' Or [NewPartNum] Like '*' & [LegacyPN2] & '*'"),"")
Your second syntax should have also worked because the Chr(34) added a double quote resulting in this final string being passed to the DLookup function in the where clause:
Like & "*" & [LegacyPN] & "*" & " Or..."
In which the [LegacyPN] field refers to the table within the DLookup query, not the current form. So I'm not sure why that didn't work. Note: single quotes or double quotes work okay in this context but not a mixture.
Double quotes get tricky within arguments of functions within a CountrolSource property (and other places).

Function DLookup in Ms Access 2016

gives me
when saving records in the system.
Can anyone let me know what is the problem in this?
xx = DLookup("[part_number]", "tblModelCost", "[Customer_ID]= " & me.Customer_ID & " and [Model] = '" & me.[txtModel] & "' and [Description] = 'screen'")
Looks like Me.Customer_Id should be Me!Customer_Id. However, that depends on the form control name and what you are trying to do. Assuming you have a control named "Customer_ID" and a field named "Customer_ID" Me.Customer_ID will try to use the the control value, me!Customer_ID will try to use the underlying bound field value. If you don't have a control named Customer_ID then using Me.Customer_ID will cause the error you are getting. (This is why you want to learn to use controls names like txtCustomer_ID for your controls. )

Access 2013 - Visual Basic issue

I am experiencing an issue with Access 2013 while creating some VBA code with a button. I would like my button to open an form using: DoCmd.OpenForm
With this command i would like to implement an WHILE condition which filters the form which is going to be opened.
I have 2 fields on the current form with:
- Start Date
- End Data
The WHILE condition must filter all records Where the column "Date" is between the 2 given dates in the previous form. So actually i would like to do something like this:
WHERE date >= Me.begin_date.value AND date <= Me.eind_date.value
I cant simply figure it out to use it in the WHILE condition of the VBA code. I can however do other things with filters in VBA like:
search_filter = "ItemID LIKE '*" & Me.search_bar.Value & "*' "
DoCmd.OpenForm "#3 search-result", acNormal, , search_filter
But now i want to have the first code sample, translated to the VBA code just like the above piece of code.
How can i achieve this?
Sorry for my bad English btw.
if i recall correctly;
generate a query based on those two values (in the query builer will do) then
forms!formname.recordsource = sql for that query here
My Question was answered on another forum (tweakers.net).
search_filter = "Date BETWEEN #" & Me.begin_date.Value & "# AND #" & Me.end_date.Value & "#"
It did the trick.

#ERROR on =IIf(DCount [...] with Alphanumeric field

I am using a DCOUNT function to look at a table in access and see if a record exists - if it does then return a yes value.
=IIf(DCount("*","COMMENTS","[PROJECTID] = " & [PROJECTID])>0,"YES","")
This works great if my ProjectID is all numeric values - I only get #Error on the alphanumeric values.
I know that I have to make the ProjectID criteria a string but am having trouble placing the quotes.
First, break out the DCount piece and work on that by itself.
It sounds like your COMMENTS.PROJECTID field is text datatype, so add quotes before and after the value you concatenate into the third DCount argument (Criteria):
DCount("*", "COMMENTS", "[PROJECTID] = '" & [PROJECTID] & "'")
After you have that piece working correctly, add it into your IIf() function.