-
Topic
-
Hi,
Two questions. I am launching my form using showmodal, and when the user clicks the submit button I run form validation routine that checks fields for appropriate entries and use exit sub and setting the modal result for the form to MRNONE to allow the user to make changes, seems to work ok however I need to set the modal result to MROK once the processing is complete to close the form. Is this the best way? (Code at bottom)
My second question is in regards to using either the Dateimepicker or TRDateTimeEdit, I am having problems writing the appropriate date or time information out to my database (MYSQL). If I use the TRDatetimeEdit and assign the variable the .text value it writes out the proper value for the date but its not a true date. Is the numeric value in julian format and if so how do I control it to write out MDY? I do not see any formatting options. I am having no success with the time portion. My only other thought is that I have to break out the date and time portion and format with code manually. Any guidance would be appreciated.
Thanks,
sfritz— Code —
Sub Main(Client, GWEvent)
dim userid
MYFORM.showmodal
End SubSub Add_Record
dim iRST
dim fname
dim lname
dim useriduserid = groupwise.EnvUserID
fname = MYFORM.fname.text
lname = MYFORM.lname.text
address = MYFORM.Address.text
dc = MYFORM.Date_of_call.text
tc = MYFORM.Time_Call.timeSet iADOObj = CreateObject(“ADODB.Connection”)
if isobject(iADOObj) then‘ open the test data source with the Connection object
iConnnectString = “Driver={MySQL ODBC 3.51 Driver}; Data Source=MySQL”
iADOObj.Open iConnnectString‘ Are we connected?
if err.number = 0 then
iSQLString = “Insert into names (date_of_call,time_of_call,firstname, lastname) values(‘” & dc & “‘,'” & tc & “‘,'” & fname & “‘,'” & lname & “‘” & “)”Set iRST = iADOObj.Execute(iSQLString)
iADOObj.Close
end if
else
call msgbox(“Failed to create ADODB.Connection object.”, vbCritical, CAPTION)
end if
Set iADOObj = Nothing
MYFORM.ModalResult = MROK
End SubSub SubmitBtnClick(Sender)
dim x, Sectioninfo, sidx, iCheckedItemsfor x = 0 to MYFORM.initial_contact.Items.count -1
if MYFORM.initial_contact.ItemChecked(x) then
iCheckedItems = iCheckedItems & MYFORM.initial_contact.items.strings(x) & vbcrlf
end if
nextif iCheckedItems = “” then
msgbox(“You must select the method of initial contact .”)
MYFORM.ModalResult = MRNONE
exit sub
end ifAdd_Record
End Sub
- You must be logged in to reply to this topic.