I am using lotus notes 8.5.2 on windows 7. I would like to create a custom view that shows all emails EXCEPT sent mail. In other words it contains: INBOX & ALL FOLDERS.
Currently my ALL DOCUMENTS view has the following formula conditions: SELECT #IsNotMember("A"; ExcludeFromView) & IsMailStationery != 1 & Form != "Group" & Form != "Person"
The SENT view has the conditions: SELECT DeliveredDate = "" & PostedDate != "" & !(#IsMember("S"; ExcludeFromView))
My thinking is that I should be able to exclude the SENT conditions from the ALL DOCUMENT condition ?
Thanks a lot
Taking all the documents that aren't in the Sent view isn't quite right, because there are a few documents that aren't in the Sent view that are also excluded from the All Documents view. The logic you want is:
SELECT (in the All Documents view) AND NOT (in the Sent view)
So, first make a copy of All Documents. You're going to keep the selection formula from the All Documents view, and put & !( ) after it, like this:
SELECT ( #IsNotMember("A"; ExcludeFromView) & IsMailStationery != 1 & Form != "Group" & Form != "Person" ) & !( )
Now, just copy the selection formula from the Sent view and put it between those empty parens, so the result is this:
SELECT ( #IsNotMember("A"; ExcludeFromView) & IsMailStationery != 1 & Form != "Group" & Form != "Person" ) & !( DeliveredDate = "" & PostedDate != "" & !(#IsMember("S"; ExcludeFromView)) )
Related
I'm writing a macro that will open an Access Database, open a form and display a specific record based on the contents of the ActiveCell. I have it mostly working, but the problem I'm having is that it opens a form that only contains the one record, so the arrow buttons at the bottom don't go to other records. Is there a way to open the form with all the records and then move to then one i want to show? I suspect it has to do with the search box at the bottom of the form, but I can't find any info about it on the internet.
Form opened by Macro:
Form opened manually:
Sub File_open()
Dim app as Object
Dim search As String: search = ActiveCell.Value
If (ActiveCell.Font.ColorIndex = 3) And (InStr(ActiveCell.Value, "-") <> 0) Then
'Open NCR Record
Set app = CreateObject("Access.Application")
app.Visible = True
app.OpenCurrentDatabase ("Z:\Quality\NCR Database\NCR Databse " & "20" & Left(ActiveCell.Value, 2) & "0101.accdb")
app.DoCmd.OpenForm "Issue Details", , , "[ID]=" & Abs(Replace(Right(search, 4), "-", ""))
Set app = Nothing
Exit Sub
End If
Msbox ("NCR Not Found.")
End Sub
UPDATE:
I've noticed that users of this database have been sloppy and the [ID] of the records don't line up with the number I get from my Abs(Replace(Right(search, 4), "-", "")) expression. I want to look at a textbox named [Title] whose control source is a field called [NCR Number] and use the search variable as is to find the record. I changed my code and now I just get a input box that is completely baffling to me:
app.DoCmd.OpenForm "Issue Details", WhereCondition:="[Title]=" & search
You're showing the form with DoCmd.OpenForm:
expression.OpenForm (FormName, View, FilterName, WhereCondition, DataMode, WindowMode, OpenArgs)
For FormName you're passing "Issue Details", skipping View and FilterName parameters, and then you provide a WhereCondition argument:
app.DoCmd.OpenForm "Issue Details", , , "[ID]=" & Abs(Replace(Right(search, 4), "-", ""))
That "[ID]=" & Abs(Replace(Right(search, 4), "-", "")) expression is the filter you're seeing.
Remove that argument, you'll remove the filter.
app.DoCmd.OpenForm "Issue Details"
Side note, don't skip optional positional arguments like that (, , ,) - consider using named arguments instead, it makes it much clearer what arguments go to what parameters:
Now you need to move the recordsets cursor to your wanted position (can be provided by.OpenArgs):
app.DoCmd.OpenForm "Issue Details", _
OpenArgs:="[ID]=" & Abs(Replace(Right(search, 4), "-", ""))
'below could be in the form itself, e-g- Form_Load, (then ref by Me)
With Forms("Issue Details").RecordsetClone
.FindFirst Forms("Issue Details").OpenArgs
If .NoMatch then
' reaction on id not found
Else
Forms("Issue Details").Bookmark = .Bookmark
End If
End With
Good Afternoon,
I have an access query that contains a list of all my customers lets call that CUS
I have another query that has a list of ORDERS
I would like to write some VBS that cycles through the customer list and exports a csv file containing all orders that belong to that customer.
The vba would then move on to the next customer on the list and perform the same action.
Any help would be great.
Snippet of code below
almost there cant get the WHERE condition working it keeps displaying a popup for me to populate however the same string is feeding the msgbox fine here is a snippet below tht is within the loop
strcustcode = rs!OCUSTCODE
ordercount = rs!orders
TIMEFILE = Format$(Time, "HHMM")
MsgBox ([strcustcode] & " has " & [ordercount] & " orders")
StrSQL = "Select * From [24-ND_Cus] where [24-ND_Cus].[OCUSTCODE] = strcustcode "
Set qd = db.CreateQueryDef("tmpExport", StrSQL)
DoCmd.TransferText acExportDelim, , "tmpExport", "c:file.csv" db.QueryDefs.Delete "tmpExport" –
Don't use [ ] around VBA variables. Don't use parens for the MsgBox when you just want to give user a message. The parens make it a function that requires a response by user to set a variable.
MsgBox strcustcode & " has " & ordercount & " orders"
Concatenate the variable into the SQL statement. If OCUSTCODE is a text type field, use apostrophe delimiters for the parameter.
StrSQL = "Select * From [24-ND_Cus] Where [OCUSTCODE] = '" & strcustcode & "'"
I don't advise code that routinely modifies design and changing a query SQL statement is changing design. If the only change is filter criteria and a dynamic parameterized query won't work, I suggest a 'temp' table - table is permanent, data is temporary. Delete and write records to the table and export the table.
I want to create a view in lotus Notes 8.5 with only mails in Send (view) and inbox (folder).
I try to custom formula
SELECT ( #IsNotMember("A"; ExcludeFromView) & IsMailStationery != 1 &
Form != "Group" & Form != "Person" ) &
!( DeliveredDate = "" & PostedDate != "" & !(#IsMember("S"; ExcludeFromView)) )
from Lotus Notes custom view received mail
or
How to Identify the Document is in Inbox/Draft/Sent in Lotus Notes Using Notes API?
and integrate #WhichFolders but without success.
I have a view in which I search for products. I'm for example looking for product 1234.
The problem is their also exist products called 1234A and 1234 C etc. When I look with the code mentioned below I get all the items from product 1234 but also from 1234A and 1234 C etc.
It has to be limited to items from product 1234 only
Search code (under Data / Search in view results):
var tmpArray = new Array("");
var cTerms = 0;
if (sessionScope.SelectedProduct != null & sessionScope.SelectedProduct != "") {
tmpArray[cTerms++] = "(FIELD spareProduct = \"" + sessionScope.SelectedProduct +
"\")";
}
if (sessionScope.Development != null & sessionScope.Development != "") {
tmpArray[cTerms++] = "(FIELD spareStatus = \"*" + sessionScope.Development +
"*\")";
}
qstring = tmpArray.join(" AND ").trim();
return qstring
I used the suggestion from Frantisek :
I made a view with a combined column . (combined with the different "keys" I search for)
Then instead of using data / search , I used data/keys with exact keymatch. In this key I combined the searched items.
Since I had a field in wich I had sometimes at the end a character "°" , and it seems that this character doesn't work with a lookup , I took it out of my view and searched item with #Word(FIELDNAME; "°" ; 1).
As Frantisek suggested I could have used #ReplaceSubstring( field; "°"; "" ) also.
I ran into an issue with the #ClientType formula in Lotus Notes. This formula should show the client type. From the Lotus help:
Returns "Notes" if the client type is a Lotus Notes client Returns
"Web" if the client type is a Web browser
#ClientType is useful within database formulas, form formulas, buttons
in forms, and "hide-when" formulas. Do not use #ClientType in column
formulas. #ClientType always returns "None" when executed in a server
background agent.
However if I run this code in an agent or action hotspot in the client:
x = Evaluate("#ClientType")
MsgBox x(0)
The result is "Web".
And if I use the notesDocument.RenderToRTItem( notesRichTextItem ) or notesDocument.ConvertToMIME( conversionType, options ) function, the #ClientType formula is also evaluated to "Web"
This is relevant because some fields in the document form in the document library use this formula in the hide when options. When a document is rendered to rich text or to MIME, this field is not included.
Is there any way to control the behavior of this formula? My only other option is to change the hide when formula's, but I would rather leave the design of the database as is.
Even though it's working on a computed field, if your agent gets that document handle then you can get from the computed field. Whereas it will not work in column formula which is already mentioned in help document.
It seems that the solution is to convert the session's convertmime flag to true after your doc.converttomime call
Code below is run from a scheduled agent.
Test 1 returns 'Nothing'
Test 2 returns 'Web'
Test 3 returns 'Nothing'
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim vntClientType As Variant
Set db=s.Currentdatabase
On Error GoTo ErrorHandling
vntClientType = Evaluate("#ClientType")
MessageBox " Test 1 before converttomime " & vntClientType(0)
Set doc=New NotesDocument(db)
Call doc.converttomime
vntClientType = Evaluate("#ClientType")
MessageBox " Test 2 after converttomime" & vntClientType(0)
s.convertmime=True
vntClientType = Evaluate("#ClientType")
MessageBox " Test 3 after s.convertmime= true" & vntClientType(0)
Exit Sub
ErrorHandling:
Error Err, Error & " - " & ", at line " & Erl & { in "} & GetThreadInfo( 1 ) & {"}
End Sub