Ciao ragazzi
rieccomi con i problemi legati alle mie "mitiche" FlexGrid (MsFlexGrid).
Con il prezioso aiuto di LMondi e di altri utenti in altri post, sono risucito a costruire delle
flexgrid in grado di gestire numeri e date, ora quello che non riesco a fare è inserire i vari record delle flex in una tabella temporanea chiamata "Prodotti", io ho costruito questo codice, ma mi da' questo errore: "Errore di conversione di tipo dati".
Vi posto il codice:
Sub AggiungiRecord_Click()
Dim dbsDB As Database
Dim rstProdotti As Recordset
Dim strCodice As String
Dim strDescrizione As String
Dim strIva As String
Dim strQuantita As String
Dim strCategoria As String
Dim strPrezzo As String
Dim strDescrizione_Reale As String
Dim strData As String
Dim strOra As String
Dim strOperatore As String
Set dbsDB = OpenDatabase("C:\...\DB_REPORT1.mdb")
Set rstProdotti = _
dbsDB.OpenRecordset("DATABASE", dbOpenDynaset)
strCodice = Trim(grdLista.TextMatrix(0, 0))
strDescrizione = Trim(grdLista.TextMatrix(0, 1))
strQuantita = Trim(grdLista.TextMatrix(0, 2))
strCategoria = Trim(grdLista.TextMatrix(0, 3))
strPrezzo = Trim(grdLista.TextMatrix(0, 4))
strIva = Trim(grdLista.TextMatrix(0, 5))
strData = Trim(grdLista.TextMatrix(0, 6))
strOra = Trim(grdLista.TextMatrix(0, 7))
strOperatore = Trim(grdLista.TextMatrix(0, 8))
strDescrizione_Reale = Trim(grdLista.TextMatrix(0, 9))
' Procede solo se l'utente ha immesso
' effettivamente dati relativi sia al nome sia al cognome.
If strCodice <> "" And strDescrizione <> "" _
And strIva <> "" And strQuantita <> "" _
And strCategoria <> "" And strPrezzo <> "" Then
' Richiama la funzione che aggiunge il record.
AggiungiProdotto rstProdotti, strCodice, strDescrizione, strQuantita, strCategoria, _
strPrezzo, strIva, strData, strOra, strOperatore, strDescrizione_Reale
' Visualizza i dati appena aggiunti.
With rstProdotti
Debug.Print "Nuovo record: " & !CODICE & _
" " & !DESCRIZIONE
.Delete
End With
Else
Debug.Print _
"È necessario immettere tutti i dati necessari!"""
End If
rstProdotti.Close
dbsDB.Close
End Sub
Function AggiungiProdotto(rstTemp As Recordset, _
strCodice As String, strDescrizione As String, _
strQuantita As String, strCategoria As String, _
strPrezzo As String, strIva As String, _
strData As String, strOra As String, _
strOperatore As String, strDescrizione_Reale As String)
With rstTemp
.AddNew
!CODICE = strCodice
!DESCRIZIONE = strDescrizione
!QUANTITA = strQuantita
!CATEGORIA = strCategoria
!PREZZO = strPrezzo
!IVA = strIva
!Data = strData
!ORA = strOra
!Operatore = strOperatore
!DESCRIZIONE_REALE = strDescrizione_Reale
.Update
.Bookmark = .LastModified
End With
End Function
Quello che non riesco a capire, è che che ho controllato la struttura della Tabella "Prodotti" nel DB, e l'ho confrontata con AggiungiProdotto e nell'evento AggiungiRecord sono identiche
VI PREGO AIUTATEMI...
Premetto che per esigenze di programma devo usare solo le FlexGrid.
GRAZIE CLAUDIO