Relatively new to Crystal Reports. I'm trying to get a date to populate normally if it is after today's date, but with a leading and following asterisk if it's prior to today's date.
What I tried:
if {V_ORD_DTL_AVALIABILITY.MUST_SHIP_DATE}>CurrentDate then {V_ORD_DTL_AVALIABILITY.MUST_SHIP_DATE}
else "* " &({V_ORD_DTL_AVALIABILITY.MUST_SHIP_DATE}) & " *"
When I check the formula I receive "A date-time is required here" error relating to:
"* " &({V_ORD_DTL_AVALIABILITY.MUST_SHIP_DATE}) & " *"
Little help for a newbie? (Also, yes, I realize "availability" is spelled incorrectly.)
I was missing was the date formatting for the else statement:
if {V_ORD_AVALIABILITY.MUST_SHIP_DATE} = DATE(0000,00,00)
then " "
else (if {V_ORD_DTL_AVALIABILITY.MUST_SHIP_DATE} <= CurrentDate
then totext({V_ORD_DTL_AVALIABILITY.MUST_SHIP_DATE}, "* M/d/yy *")
else totext({V_ORD_DTL_AVALIABILITY.MUST_SHIP_DATE}, "M/dd/yy")}
Related
Microsoft 365 V2205, build 15225.20204
The following VBA macro used to work, and it still works when run manually. A couple of years ago, I am guessing that a change from Microsoft occurred, and it now returns the error code "an unexpected error has occurred" when Outlook automatically runs it. Can someone show me a fix for the rule/VBA that will allow the rule/VBA to:
On an incoming email
Mark it as high importance
Update the subject
Set a category “Bill”
Set a reminder
Here is the:
Rules description
Apply this rule after the message arrives
With ‘Your credit card statement is ready’ or ‘Your statement is ready for credit card ending’
And on this computer only
Mark it as high importance
And run Damian.PendingPaid1
Here is the VBA:
Sub PendingPaid1(Item As Outlook.MailItem)
Item.Categories = "Bill"
Item.Subject = Item.Subject & " " & Chr(150) & " Pending " & Chr(150) & " PAID " & Chr(150) & " 220"
Item.ReminderSet = True
Item.FlagDueBy = Date + 1 & Space(1) & "8:45 AM" ' Remind 1 day from now.
Item.ReminderTime = Date + 1 & Space(1) & "8:45 AM" ' Remind 1 day from now.
Item.Save
End Sub
I am working in SSDT creating a report. Trying to get a row/field to display "Su 1" , "Mo 2" for the day of week + increment the number of that day in the pay period.
First half of code works. returning (Mo, Tu, We, Th, Fr etc)
= LEFT(FORMAT(Fields!TransactionDate.Value,"ddd"),2)
Issue Need to complete 2nd half to provide the increment count for the pay period.
Code: + " "+ (STR(FORMAT(Fields!TransactionDate.Value,"d"))
FIX! bottom line of code produced the result I needed.
=LEFT(FORMAT(Fields!TransactionDate.Value,"ddd"),2)
+ " "+ CStr(CInt(Format(Fields!TransactionDate.Value,"dd")))
I have a report that has several sub-reports as well as a sub-report to one of the sub-reports.
The one that concerns me:
rptProgressReport ->rptEmployee (sub of rptProgressReport) -> rptSubEmployeeProject (sub of rptEmployee)
So far everything is generating as needed. Employees list in order, and the sub-report pulls out various project details. Except I need to add together time spent from one table.
tblProject (main table) -> tblProjectHistory (related table to tblProject via projectID->fldProjectID).
tblProjectHistory has the following fields.
[historyID],[fldProjectID], [History Information], [History Date], [Time Spent], [Employee].
I need to do a sum of all [Time Spent] for projects that equal what is being displayed and as long as the employee matches and the date is within the specified date range.
Specified date range is via the launching Form (frmReportGeneration) with fields txtStartDate and txtEnd Date.
Sub-report rptSubEmployeeProject has a text box (txtTimeSpent) that I have the following for a control source.
=Sum(DLookUp("[Time Spent]","tblProjectHistory","[Employee]='" & [Reports]![rptEmployee].[txtTempEmployee] & "' AND [History Date] > " & [Forms]![frmReportGeneration].[txtStartDate] & " AND " & [History Date]<" & [Forms]![frmReportGeneration].[txtEndDate] & "))
the rptEmployee field of txtTempEmployee correctly displays the current employee to match in that sub-report.
The problem is I get prompted for each value part of the above code - txtTempEmployee and txtStartDate/txtEndDate, even if I change the report value to be [Reports]![rptProgressReport]![rptEmployee].[txtTempEmployee]
Any idea how to correctly pull variables from the parent report or the first sub-report?
Thank you.
+++++ Update +++++
Okay update/close on this. I ended up needing to do something similar to what was suggested in the accepted answer. I could not get the idea posted to work - but i was able to set tempvars in vba and used those throughout the report/sub-report(s).
it is not recommended to refer to other objects via this construct "Forms!...." (or "Reports!...")
i made some bad experience with it. i suggest to put the values into a variable and make a
Get-Funktion:
in a Module you define:
Publicg dtStart As Date
Public gdtEnd As Date
in the form you assign the start and end date in the button where you fire the report
gdtStart = Me!txtStartDate
gdtEnd = Me!txtEndDate
now the Get-Function:
Public Function Get_Date_Start () As Date
Get_Date_Start = gdtStart
End Function
Public Function Get_Date_End () As Date
Get_Date_End = gdtEnd
End Function
in the Query you can use it now like this:
... AND [History Date] > " & Get_Date_Start() & " AND " & [History Date] <" & Get_Date_End()
BTW: don't use spaces in any object-name: instead of [History Date] name it History_Date, you can avoid Brackets in Code :-)
I have the first password from a text box:
pwtextbox = TextBox2.Text
and the other one I am reading from a DB Table:
pwdatabase = SQLdr("pw")
I've tried to compare them using '=', StrComp, and strings.compare and they always, no matter what, come as different
While SQLdr.Read() 'While Data is Present
pwdatabase = SQLdr("pw") 'pwdatabase is equal db entry
Response.Write(pwtextbox & "=" & pwdatabase & "?<br>") 'is mickey=mickey?
If StrComp(pwtextbox, pwdatabase) = 0 Then
Response.Write("login successful")
Response.Write(pwdatabase & "is the pass")
Else
Response.Write("wrong password. ")
Response.Write(TextBox2.Text & " is the wrong pass. the right password is " & pwdatabase)
End If
End While
the onscreen display outputs as follow:
mickey=mickey?
wrong password.
mickey is the wrong password. the right password is mickey.
I can't seem to understand!
especially when I see on the screen that the two strings are identical, I still get this false positive...
can you see what I'm missing?
I have crystal reports and in formula editor, based on date.
If {?PDATERANGE1} <> "" AND {?PDATERANGE2} <> "" Then
ToText(DateValue({?PDATERANGE1}), "MMM d, yyyy") & " - " & ToText(DateValue({?PDATERANGE2}), "MMM d, yyyy")
I am calling this from ASP and PDATERANGE1 and PDATERANGE2 are "10/10/2001" and "10/12/2001".
I am getting the following error.
Bad date format string. Details: errorKind Error in File {B6624BE5-D6DA-469B-A635-9FE86B125492}.rpt: Error in formula dt_range: 'If {?PDATERANGE1} <> "" AND {?PDATERANGE2} <> "" Then ' Bad date format string. Details: errorKind
Could someone please tell me what is wrong? I am not a crystal reports developer.
If the values of {?PDATERANGE1} and {?PDATERANGE2} include double quotes - so that they are "10/10/2001" and "10/12/2001" respectively - then these double quotes need to be removed (so that they become 10/10/2001 and 10/12/2001 respectively).
I think it's because "" is not a valid date. Are the paramaters optional and you're checking whether they have values?
In crystal you have to use function hasvalue({?parameter}) though optional parameters tend to cause real issue so i avoid them like the plague!