Bharat_Naik
Senior Member Members
    Offline
 Ever ready to learn and share
Posts: 1202
Location: Chicago, Illinois
Joined: Dec 16 th, 2003
|
Re: Note lines on a file
Reply #6 - Feb 6th, 2004 at 12:51am
|
Print Post
|
Justin,
I was experimenting with the SubForm using Sbasic and Sesame tools to achieve what you are trying to do. As I understand, what you want are the followings:
1. Take the ClientID automatically from the mainform to subform and assign it ClientID in Subform. 2. Enter Date automatically in Subform and so is the time. 3. Sort the records in SubForm in descending order of dateofnotes automatically.
(You cannot make a field invisible in subform, I settled it for having read only)
Here how I have achieved all of the required.
In the mainform, in ClientID on Form entry event, please put the following code
if @update then {
Globalvalue ("main ClientID", ClientID) writeln (@globalvalue ("main ClientID") + " is new Globalvalue")
}
//for new Client
In the mainform, in ClientID on Element Exit event, please put the following code
if @Isnew then {
Globalvalue ("main ClientID", ClientID) writeln (@globalvalue ("main ClientID") + " is new Globalvalue")
}
You may remove writeln line after you are confident that the code is working.
=========
Now goto the subform (not in the Form-Subform setup, but only subform by itself), in your case, I think it is notes.db
On form entry goes following code (you can put this in the form name that is also listed as an element in the program editor drop-down menu for elements)
ClientID = @globalvalue ("Main ClientID")
On Record exit event in ClientID, please put following Code:
If DateOfNote = "" then { DateOfNote = @Date }
you can use the same method to get present time entry automatically.
This much should achieve our first two goals.
For the third and Final, I had used Macro:
(As such the third step could have been achieved with programming with @SelectTreeItem( ) and @LoadSortSpec ( ) but I could not get @LoadSortSpec to work. I believe the problem is already fixed for Sesame, version 1.0.2)
First Make the Sort Spec that will Sort DateOfNote field in Notes subform and save that. We will use this macro. Search the main Database with all record and hit F10 to creat the record set of all records.
Now start recording Macro, first take the cursor to one of the main form element, hit <Alt -f8>, open dropdown menu in specmanager choose sort, and then load the sort spec you had earlier created. make sure the cursor is in the mainform element and hit <alt R>, (you will see that this arranged records in descending order of the dateOfNote. You can assign this macro to a button in the main form.
|