Hello, Can anyone solve my issue
Form: SB_1
Form: Add_NewRelation s
I have used a VBA code in Form: SB_1 on a cmd (Button) for Data passing from one form to another form of Add_NewRelation s for New Customer details are needed to update into Form: Add_NewRelation s.
So that VBA code is working well. But some of exist customer details are no need to update into Form: Add_NewRelation s and only allow for New Customer details.
So I have added an If statement with Dcount in the code for exist customers no need to add in the Form: Add_NewRelation s. So If Statement with Dcount is didn’t working… how to correction from DCount?? When i was used Dcount function then whole VBA code is not working…
I have attached the dB file can anyone please see once VBA code and correction it.
Thanks,
Sandhya.
Form: SB_1
Form: Add_NewRelation s
I have used a VBA code in Form: SB_1 on a cmd (Button) for Data passing from one form to another form of Add_NewRelation s for New Customer details are needed to update into Form: Add_NewRelation s.
So that VBA code is working well. But some of exist customer details are no need to update into Form: Add_NewRelation s and only allow for New Customer details.
So I have added an If statement with Dcount in the code for exist customers no need to add in the Form: Add_NewRelation s. So If Statement with Dcount is didn’t working… how to correction from DCount?? When i was used Dcount function then whole VBA code is not working…
I have attached the dB file can anyone please see once VBA code and correction it.
Code:
Private Sub Button_Click()
On Error GoTo ErrorHandler
'Me.Refresh
Dim strCriteria As String
strCriteria = "CIDCustomer = '" & Trim(Trim(Me!RID) & " " & Trim(Me!RName)) & "'"
'If DCount("*", "CIDCustomer", "RelationsQry") > 0 Then
'Cancel = True
'Else
If DCount("*", "RelationsQry", strCriteria) > 0 Then
Cancel = True
Else
'If Not IsNull([Customer]) Then
'Me.Visible = False
DoCmd.OpenForm "Add_NewRelations", acNormal, , , , acWindowNormal
Forms![Add_NewRelations].Form.RID = Me.CID2
Forms![Add_NewRelations].Form.RName = Me.Customer
Forms![Add_NewRelations].Form.RType.Value = "Customer"
Forms![Add_NewRelations].Form.Address = Me.Address
Forms![Add_NewRelations].Form.TINNumber = Me.TINNumber
Forms![Add_NewRelations].Form.TownVLG = Me.TownVLG
Forms![Add_NewRelations].Form.RName.SetFocus
'Forms![Add_NewRelations].Visible = False
'DoCmd.Close
End If
ErrorHandler:
End Sub
Thanks,
Sandhya.
Comment