Ciao avevo creato un loop su delle opt presenti in un form ma ora non va piu', non funziona il ciclo
In grassetto la parte incriminata, se vado in debug, quando sono nel ciclo mi dice variabile ... non impostata ed esce, perchè?codice:Private Sub controllaOpt() On Error Resume Next Dim opt As OptionButton Dim frm As Form Set frm = frmRegistrazione For Each opt In frm If opt.Value = True Then Select Case opt.Tag Case "A": caricaAlbero Case "B": If txtDATA.Text = "" Or txtDATA2.Text = "" Then MsgBox "Inserire entrambe le date." txtDATA.SetFocus Exit Sub Else Dim dDate As String Dim aDate As String If Not IsDate(Trim(txtDATA)) Then txtDATA = Format(Date, "dd" & sDate & "mm" & sDate & "yyyy") If Not IsDate(Trim(txtDATA2)) Then txtDATA2 = Format(Date, "dd" & sDate & "mm" & sDate & "yyyy") dDate = Format(txtDATA, "mm/dd/yy") dDate = Replace(dDate, ".", "/") aDate = DateAdd("d", 1, CDate(txtDATA2)) aDate = Format(aDate, "mm/dd/yy") aDate = Replace(aDate, ".", "/") RICERCA "DataModifica Between #" & dDate & "# And #" & aDate & "# " End If Case "C": If txtCLIENTE.Text = "" Then MsgBox "Scegliere un Cliente / Fornitore" txtCLIENTE.SetFocus Exit Sub Else RICERCA "CLIENTE = " & lblID_CLIENTE.Caption End If Case "D": If txtFATTURA.Text = "" Then MsgBox "Inserire un numero da ricercare." txtFATTURA.SetFocus Exit Sub Else RICERCA "FATTURA = " & txtFATTURA.Text End If End Select End If Next End Sub


Rispondi quotando
