I'm sure I am making a simple mistake. I would like to be able to view contracts and other customer documents.
I have a table with four or five fields one of which is a RTF memo field. I thought one quick way to load a cocument was to use the import feature. I opened the table in browse mode, clicked on the field, went to edit and import RTF. The program brings up the screen to locate the document which I select. The problem nothing happens. I can't see a form. I have even clicked on the editor after the above and can't see the form there either.
Eventially, I will want to load contracts in an easier manner so I created a button and set an on push event and connected the following code to see if it would work.
'Date Created: 05-Aug-2008 04:03:41 PM
'Last Updated: 06-Aug-2008 11:08:52 AM
'Created By : rross
'Updated By : rross
'Create an XDialog dialog box to prompt for parameters.
DIM SHARED V_taxID as C
DIM SHARED V_Type as C
DIM SHARED V_Location as C
DIM SHARED V_ExpireDate as D
DIM SHARED V_filename as C
DIM SHARED varC_result as C
ok_button_label = "&Enter Record"
cancel_button_label = "&Cancel"
varC_result = ui_dlg_box("Contract Data",<<%dlg%
{region}
Tax ID:| [.40V_taxID];
Contract Type:| [.40V_Type];
Location:| [.40V_Location];
Expiration Date:| [%DATE%.40V_ExpireDate!V_ExpireDate_*];
Choose File Name \(.rtf):| [.40V_filename];
{endregion};
{line=1,0};
{region}
<*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
{endregion};
%dlg%,<<%code%
if left(a_dlg_button,13) = "V_ExpireDate_" then
if a_dlg_button = "V_ExpireDate_killfocus" then
V_ExpireDate = ctod(dtoc(V_ExpireDate))
end if
a_dlg_button = ""
end if
%code%)
'Open new record in Contract form
Dim tbl as p
tbl=table.open("contracts")
tbl.enter_begin(.t.)
tbl.con_taxid=V_taxID
tbl.con_type=V_Type
tbl.con_location=V_Location
tbl.con_expire=V_ExpireDate
tbl.con_rtf.memo_read_from_file(V_filename)
tbl.enter_end (.t.)
Tbl.close()
I'm sure the coding isn't efficient and I need some error checking but anyway I wanted to see if I was on the right track. I get the dialog box and after filling all the boxes and pushing OK it seemed to take afew seconds and work. However, when I get back to the browse I see a new record with all the fields updated but still nothing in the memo field. (I am loading a document with an .rtf extension.)
Am I misunderstanding the intended use of the memo field? If there is a solution, can PDFs and Text files also be loaded? Thanks for any help.
I have a table with four or five fields one of which is a RTF memo field. I thought one quick way to load a cocument was to use the import feature. I opened the table in browse mode, clicked on the field, went to edit and import RTF. The program brings up the screen to locate the document which I select. The problem nothing happens. I can't see a form. I have even clicked on the editor after the above and can't see the form there either.
Eventially, I will want to load contracts in an easier manner so I created a button and set an on push event and connected the following code to see if it would work.
'Date Created: 05-Aug-2008 04:03:41 PM
'Last Updated: 06-Aug-2008 11:08:52 AM
'Created By : rross
'Updated By : rross
'Create an XDialog dialog box to prompt for parameters.
DIM SHARED V_taxID as C
DIM SHARED V_Type as C
DIM SHARED V_Location as C
DIM SHARED V_ExpireDate as D
DIM SHARED V_filename as C
DIM SHARED varC_result as C
ok_button_label = "&Enter Record"
cancel_button_label = "&Cancel"
varC_result = ui_dlg_box("Contract Data",<<%dlg%
{region}
Tax ID:| [.40V_taxID];
Contract Type:| [.40V_Type];
Location:| [.40V_Location];
Expiration Date:| [%DATE%.40V_ExpireDate!V_ExpireDate_*];
Choose File Name \(.rtf):| [.40V_filename];
{endregion};
{line=1,0};
{region}
<*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
{endregion};
%dlg%,<<%code%
if left(a_dlg_button,13) = "V_ExpireDate_" then
if a_dlg_button = "V_ExpireDate_killfocus" then
V_ExpireDate = ctod(dtoc(V_ExpireDate))
end if
a_dlg_button = ""
end if
%code%)
'Open new record in Contract form
Dim tbl as p
tbl=table.open("contracts")
tbl.enter_begin(.t.)
tbl.con_taxid=V_taxID
tbl.con_type=V_Type
tbl.con_location=V_Location
tbl.con_expire=V_ExpireDate
tbl.con_rtf.memo_read_from_file(V_filename)
tbl.enter_end (.t.)
Tbl.close()
I'm sure the coding isn't efficient and I need some error checking but anyway I wanted to see if I was on the right track. I get the dialog box and after filling all the boxes and pushing OK it seemed to take afew seconds and work. However, when I get back to the browse I see a new record with all the fields updated but still nothing in the memo field. (I am loading a document with an .rtf extension.)
Am I misunderstanding the intended use of the memo field? If there is a solution, can PDFs and Text files also be loaded? Thanks for any help.
Comment