The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
inserting data in to account table along with new fields
Posted: 17 Apr 07 2:46 PM
|
Dear all, I am beginner to saleslogix. Right now i am working on saleslogix 7.0.I need to insert data for 20 more user fields in account table. This twenty user fields i have designed on another form(not on add contact account form due to not having place).So i am calling this new form by placing a button called "next" in add contact account form. So after i punched data what code i have to write in the save button of newly created form so that entire data should enter in to account table (along with data in the earlier(add contact account screen) )
pls help me
vamsi |
|
|
|
Re: inserting data in to account table along with new fields
Posted: 18 Apr 07 12:27 AM
|
Vamsi:
There are several ways to do this, specially depending on what you have in your hands.
In your situation, I would've started by having the "Next" button commit the Data for the Contact and Account, and retreiving the new IDs. Then if the data for the addtl 20 fields was account related, I would've created an Account Based form and used the ShowViewForRecord function to load the view thus having it bound to the new Account record ID. Had you done this, then you would have nothing to do but to Save the form by the OK button
Assuming that the Form you have is not bound to the DB, then you would have to use ADODB code to save the data. You would still need to get the Account (and/or the Contact) ID and then just create the necessary records via ADODB.
The code below is just an example, and is only for illustration, I have not tested it, so even the sintax might be slightly off:
Dim strSQL Dim rec Dim con
strSQL = "SELECT * FROM ACCOUNT2 WHERE ACCOUNTID = '" & myNewAcctID & "'"
Set con = Application.GetNewConnection Set rec = con.Execute strSQL If rec.RecordCount = 0 then 'Need to create record on this table rec.AddNew rec("ACCOUNTID").Value = myNewAcctID rec("CREATEDATE").Value = Application.BasicFunctions.DateToIso(Now()) rec("CREATEUSER").Value = Application.BasicFunctions.CurrentUserID End If
rec("MODIFYDATE").Value = Application.BasicFunctions.DateToIso(Now()) rec("MODIFYUSER").Value = Application.BasicFunctions.CurrentUserID
rec("CUSTOMFIELD1").Value = myVal1 rec("CUSTOMFIELD2").Value = myVal2 .. rec("CUSTOMFIELD20").Value = myVal20
rec.Update
Set rec = nothing Set con = nothing
|
|
|
|
Re: inserting data in to account table along with new fields
Posted: 18 Apr 07 2:31 AM
|
fiogf49gjkf0d Suggest you do not use string formatted datetime values when dealing wiht ADO objects (fields and parameters). When dealng with raw SQL statments, then must use IDO formatted DateTime strings with SLX, however ADO objects are data typed.
Rather than rec("CREATEDATE").Value = Application.BasicFunctions.DateToIso(Now())
Use rec("CREATEDATE").Value = Now()
This clarification/recommendation came to me via the guy that developed the SLX OleDB Provider so I consider it to me pretty solid advice.
|
|
|
| |
|
Re: inserting data in to account table along with new fields
Posted: 20 Apr 07 8:17 AM
|
As Per Todd's post... A - When using an ADO Recordset, Always pass in proper typed values. This is especially true when refering to datetime fields since you will break sync if you fail to do so. B - When using an SQL Insert/Update, etc.. Statement, always convert the typed value(s) to strings when refering to dateTiime. Make sure you are conforming to the proper format (CCYYMMDD HH:MM:SS) or you will break sync. TheDateToIso function will do it correctly. -- rjl |
|
|
|