Ciao, ancora io.
Devo verificare, prima di eseguire una query insert into, che un campo della tabella di access sia debitamente compilato e nel caso sia vuoto o nullo, nella query va scritto valore NULL; questo controllo riguarda più campi contemporaneamente e volevo sapere se potevo con un solo comando controllare simultaneamente tutti i campi.
Questo è il code con il controllo campo x campo singolo:
codice:
if IsNull(rec("A")) or IsEmpty(rec("A")) or Len(rec("A"))="" then
A = "NULL"
else
A = rec("A")
end if
if IsNull(rec("B")) or IsEmpty(rec("B")) or Len(rec("B"))="" then
B = "NULL"
else
B = rec("B")
end if
if IsNull(rec("C")) or IsEmpty(rec("C")) or Len(rec("C"))="" then
C = "NULL"
else
C = rec("C")
end if
SQL = "INSERT INTO tblx (A, B, C) VALUES (& REC("A") &"#, "& REC("B") &", '"& REC("C") &"')"
MyConn.execute(SQL)
Gracias!!!