ramasco
New member
- Local time
- Tomorrow, 00:38
- Joined
- May 15, 2020
- Messages
- 28
Hi,
I made one form to save contacts of two separate tables for Brokers or Clients. In the contacts's table I made a relation with each table (screenshot attached).
When the form is open by the Brokers's form the client field with the ID is empty. When I open it from the client's form it goes viceversa.
When I save the record of a broker's contact (same for client's contact) it shows up the error. It says is not possible to save because there's no relation with the other table.
I need to keep only one table for the contacts.
Is there a way to skip the need to the other relation?
Here the code for saving:
Thank you in advance for any help
Massimo
I made one form to save contacts of two separate tables for Brokers or Clients. In the contacts's table I made a relation with each table (screenshot attached).
When the form is open by the Brokers's form the client field with the ID is empty. When I open it from the client's form it goes viceversa.
When I save the record of a broker's contact (same for client's contact) it shows up the error. It says is not possible to save because there's no relation with the other table.
I need to keep only one table for the contacts.
Is there a way to skip the need to the other relation?
Here the code for saving:
Code:
Private Sub cmdSalva_Click()
'On Error Resume Next
Dim numIDSymphony As String
Dim numIDBroker As String
Dim NomeFonte As String
If IsNull(Me.txtIDSymphonyCont) Then
numIDBroker = Forms("Contatto_Ins")!txtIDBrokerCont
NomeFonte = Forms("Contatto_Ins")!txtNomeBroker
DoCmd.RunCommand acCmdSaveRecord
DoCmd.GoToRecord , "", acNewRec
Forms("Contatto_Ins")!txtIDBrokerCont = numIDBroker
Forms("Contatto_Ins")!txtRagioneSociale = NomeFonte
Forms("Contatto_Ins")!cboTitolo.SetFocus
MsgBox "Contatto salvato" & vbCrLf & " Inserisci ulteriore contatto" & vbCrLf & _
" oppure " & vbCrLf & " Annulla per uscire", vbOKOnly, "Eseguito!"
End If
If IsNull(Me.txtIDBrokerCont) Then
numIDSymphony = Forms("Contatto_Ins")!txtIDSymphonyCont
NomeFonte = Forms("Contatto_Ins")!txtRagioneSociale
DoCmd.RunCommand acCmdSaveRecord
DoCmd.GoToRecord , "", acNewRec
Forms("Contatto_Ins")!txtIDSymphonyCont = numIDSymphony
Forms("Contatto_Ins")!txtRagioneSociale = NomeFonte
Forms("Contatto_Ins")!cboTitolo.SetFocus
MsgBox "Contatto salvato" & vbCrLf & " Inserisci ulteriore contatto" & vbCrLf & _
" oppure " & vbCrLf & " Annulla per uscire", vbOKOnly, "Eseguito!"
End If
End Sub
Thank you in advance for any help
Massimo
Attachments
Last edited: