I have been working on a VBA code for Dynamics GP 2010 . the part that I have an issue right now is that I am updating a record that is not yet created.
well let me tell you a little more: on the RMA Entry Update Grid , I created a new field that display the UserDefine 3 ( my field is Cust Part#) from the SVC05200 table for the current RMA.
so currently I am updating the table for this field when the field changes but that's not the best way, I thought using the saving button but everytime I click save the record gets clear.
How can I fix that?
'update the UserDefined window for Customer Part
Private Sub StrCustPart_Changed()
If IntRunCode = 1 Then
'Retrieve an ADO Connection for the current user
'Set the current Database company
Set cn = UserInfoGet.CreateADOConnection
cn.DefaultDatabase = UserInfoGet.IntercompanyID
cmd.ActiveConnection = cn
'push the cust part# in table SVC05200
strsql = " Select count(*) from SVC05200 where RETDOCID = '" & RMAEntryUpdate.RMANumber & "' and LNSEQNBR = '" & CStr(CDbl(LineSequence)) & ".00000' "
Set rst = cn.Execute(strsql)
If rst.Fields(0).Value = 1 Then
cmd.CommandText = " UPDATE SVC05200 set USRDEF03='" & StrCustPart & "' where RETDOCID = '" & RMAEntryUpdate.RMANumber & "' and LNSEQNBR = '" & CStr(CDbl(LineSequence)) & ".00000' "
MsgBox ("The line Item is not created yet. You need to Create the line item then retype the Customer Part#. If you don't retype it, the Customer Part will not be saved")
' StrCustPart.Value = ""