Salve a tutti; qualcuno di lor dotti signori può spiegarmi perchè, aprendo una form toobox, su una form FMain, per richiuderla con il pulsante "btnQuit", il comando ME.Close funziona, invece con il pulsante "btnOK", dopo aver eseguito vario codice, il comando ME.Close mi dà l'errore "invalid object".
Eliminando il comando di cui sopra, la form si chiude senza errori.
sql = "SELECT id FROM tclienti ORDER BY id"
MyRes = modConn.$Conn.Exec(sql)
FOR EACH MyRes
FMain.tbContCli.Text = MyRes!id
NEXT
FMain.Enabled = TRUE
FMain.gridModo = FALSE
' ME.Close
END
PUBLIC SUB btnQuit_Click()
FMain.Enabled = TRUE
FMain.gridModo = FALSE
ME.Close
END
Grazie.
Salva a tutti; ho risolto cambiando ME con il nome della form.
Non sò perchè, ma così và.
sql = "SELECT id FROM tclienti ORDER BY id"
MyRes = modConn.$Conn.Exec(sql)
FOR EACH MyRes
FMain.tbContCli.Text = MyRes!id
NEXT
FMain.Enabled = TRUE
FMain.gridModo = FALSE
NewCli.Close
END
PUBLIC SUB btnQuit_Click()
FMain.Enabled = TRUE
FMain.gridModo = FALSE
ME.Close
END
PUBLIC SUB btnOK_Click()
DIM sql AS String
DIM iListino AS Integer
IF FMain.gridModo = FALSE THEN
IF txtCogn.Text = "" THEN
Message.Error("<b>Il campo Cognome è vuoto!</b>")
ELSE IF txtNome.Text = "" THEN
Message.Error("<b>Il campo Nome è vuoto!</b>")
ELSE
IF FMain.gridModo = FALSE THEN
Inserisci
ELSE
sql = "SELECT id FROM tclienti WHERE cogn = '" & FMain.gridCogn & "' AND nome = '" & FMain.gridNome & "'"
MyRes = modConn.$Conn.Exec(sql)
sql = "DELETE FROM tclienti WHERE id = " & MyRes!id
MyRes = modConn.$Conn.Exec(sql)
FMain.gridModo = FALSE
Inserisci
ENDIF
ENDIF
ELSE
IF FMain.bLogin THEN
IF RadioButton1.Value THEN
iListino = 1
ELSE IF RadioButton2.Value THEN
iListino = 2
ELSE IF RadioButton3.Value THEN
iListino = 3
ELSE IF RadioButton4.Value THEN
iListino = 4
ENDIF
sql = "UPDATE tclienti SET cogn = '" & txtCogn.Text & "', nome = '" & txtNome.Text & "', indir = '" & txtIndir.Text & "', cap = '" & txtCap.Text & "', citta = '" & txtCitta.Text & "', prov = '" & txtProv.Text & "', cell = '" & txtCell.Text &
"', tel = '" & txtTel.Text & "', fax = '" & txtFax.Text & "', email = '" & txtEmail.Text & "', pi = '" & txtPi.Text & "', cf = '" & txtCf.Text & "', note = '" & txtNote.Text & "', nlist = " & iListino &
", pnt = 0, cred = 0.00 WHERE cogn = '" & FMain.gridCogn & "' AND nome = '" & FMain.gridNome & "'"
MyRes = modConn.$Conn.Exec(sql)
ENDIF
ENDIF
sql = "SELECT id FROM tclienti ORDER BY id"
MyRes = modConn.$Conn.Exec(sql)
FOR EACH MyRes
FMain.tbContCli.Text = MyRes!id
NEXT
FMain.Enabled = TRUE
FMain.gridModo = FALSE
NewCli.Close
END
PUBLIC SUB btnQuit_Click()
FMain.Enabled = TRUE
FMain.gridModo = FALSE
ME.Close
END