Originariamente inviato da edoappa
ho creato una maschera per la ricerca dati; in origine dati ho messo la query che accettta il contenuto dei campi della maschera. la ricerca funziona, ma nel momento in cui la query non restituisce dati, dovrebbe passare in un if e mostrare un msgbox.
ora mi sembra anche di aver visto, con il debug, che esce dierettamente senza passare nell'IF....
poi, con il Me.Requery, non dovrebbe ricaricarmi la maschera..non so. allego codice:
Private Sub Num_Commessa_Change()
On Error GoTo Num_Commessa_Err
Dim strMsg As String, strTitolo As String
Dim intStile As Integer
If Right(Me.Num_Commessa.Text, 1) = " " Then
Exit Sub
Else
Me.Requery
Me.Recalc
Me.Num_Commessa.SetFocus
Me.Num_Commessa.SelStart = Me.Num_Commessa.SelLength
MsgBox Me.Conta
End If
If Me.Conta = 0 Then
strMsg = "NESSUNA COMMESSA PER LA RICERCA --> " & Me.Num_Commessa & "." & vbCrLf + vbCrLf & "Controllare i dati immessi"
intStile = vbOKOnly + vbExclamation
strTitolo = "ATTENZIONE"
MsgBox strMsg, intStile, strTitolo
Pulisci_Click
Me.Num_Commessa.SetFocus
End If
Num_Commessa_Exit:
Exit Sub
Num_Commessa_Err:
Resume Num_Commessa_Exit
End Sub