amorosik
Active member
- Local time
 - Today, 15:03
 
- Joined
 - Apr 18, 2020
 
- Messages
 - 667
 
I have a continuous form linked to a DOCUMENTITESTATE table
In the middle above there are textbox-type fields connected to some fields of the table
Below In the body section there are some fields, connected to the data of the DOCUMENTITESTATE table
I use a Command Button to add new records, and the code inside cmdAdd is this:
	
	
	
		
In the Before_Insert event code there is the actual code that adds the new record
	
	
	
		
The problem is that this code gives me error 2105 on line 110 in correspondence with the DoCmd.GoToRecord , , acNewRec
And this behavior only happens a few times, say once out of 5-10 insertions
And ONLY on the version compiled in accde
If I use that piece of code from accdb version, it never reports any errors even after 100 entries in a row, never
Access 2013, 32bit, Windows10 pro, tables connected via odbc to an external db server physically on another pc on the lan
What could cause the different functioning between accdb and accde versions?
Or what is wrong with the above code?
 In the middle above there are textbox-type fields connected to some fields of the table
Below In the body section there are some fields, connected to the data of the DOCUMENTITESTATE table
I use a Command Button to add new records, and the code inside cmdAdd is this:
		Code:
	
	
	Public Sub cmdAggiungi_Click()
10        On Error GoTo eh_cmdAggiungi_Click
  
40        Form_BeforeInsert False
50        Me.Dirty = False
60        Form_Current
70        Me.cmbCodice.SetFocus
110       Exit Sub
eh_cmdAggiungi_Click:
120       msg_err err.Number, Erl, Error, "cmdAggiungi_Click of Documento VBA Form_frmDocumenti"
130       Resume Next
End Sub
	In the Before_Insert event code there is the actual code that adds the new record
		Code:
	
	
	Private Sub Form_BeforeInsert(Cancel As Integer)
10        On Error GoTo eh_Form_BeforeInsert
        
20        If Len(tipo_documento_attuale) = 1 Then
30            ser_doc = InputBox("Inserire la serie documento o premere ENTER per accettare la serie proposta (verra' presa la prima lettere inserita)" & Chr(10) & "(caratteri validi per la 'serie' sono il carattere 'spazio' e tutte le lettere)", "SERIE DOCUMENTO", " ")
40            If Len(ser_doc) < 1 Then Exit Sub
50            If Len(ser_doc) > 1 Then ser_doc = Left$(ser_doc, 1)
60            ser_doc = UCase$(ser_doc)
        
70            If InStr(" ABCDEFGHILMNOPQRSTUVZKJXY", ser_doc) = 0 Then
80                dummy = MsgBox("La SERIE DOCUMENTO deve essere un valore alfabetico compreso tra i seguenti caratteri ABCDEFGHILMNOPQRSTUVZKJXY oppure un carattere SPAZIO", , "SERIE DOCUMENTO NON VALIDA")
90                Exit Sub
100               End If
110           DoCmd.GoToRecord , , acNewRec
120           dummy = dati_testata_record_da_form(Me.Form)
130           Me!ID_DOCUMENTITESTATE = NUOVO_VALORE_DA_GENERATORE_GLOBALE()
140           Me!TIPO_DOCUMENTO = tipo_documento_attuale
150           Me!SERIE_DOCUMENTO = ser_doc
160           Me!DATA_DOCUMENTO = Format$(Now(), "dd/mm/yyyy")
170           Me!ORA_DOCUMENTO = Format$(Now(), "hh:nn:ss")
180           Me!NUMERO_DOCUMENTO = NUOVO_NUMERO_DOCUMENTO(tipo_documento_attuale, ser_doc)
190           Else
200           dummy = MsgBox("Impossibile trovare il TIPO DOCUMENTO da aggiungere", , "TIPO DOCUMENTO NON DEFINITO")
210           End If
        
220       Exit Sub
eh_Form_BeforeInsert:
230       msg_err err.Number, Erl, "Form_BeforeInsert of Documento VBA Form_frmDocumenti"
240       Resume Next
End Sub
	The problem is that this code gives me error 2105 on line 110 in correspondence with the DoCmd.GoToRecord , , acNewRec
And this behavior only happens a few times, say once out of 5-10 insertions
And ONLY on the version compiled in accde
If I use that piece of code from accdb version, it never reports any errors even after 100 entries in a row, never
Access 2013, 32bit, Windows10 pro, tables connected via odbc to an external db server physically on another pc on the lan
What could cause the different functioning between accdb and accde versions?
Or what is wrong with the above code?