|
-
January 9th, 2012, 01:01 PM
#6
Re: Transfer date to access dbase if issue
Hello again,
ok, i will test it in access also
I think i did not do the test right the first time.
Really sorry.
I forgot to test that part of the code:
Code:
IIf(etape2.Text <> "", "[Etape2_date]", "'" & DTPicker19 & "'")
So if i test all this:
Code:
'Insert data in Microsoft Access Data Base
Dim sql$
Dim MyConn As ADODB.Connection
Set MyConn = New ADODB.Connection
Dim MyRecSet1 As New ADODB.Recordset
MyConn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;" & "Data Source=" & Form4.base_de_donnee.Text
MyConn.Open
sql = "INSERT INTO DBase_vignoble_personnalise ([Date_of_day], [Client], [Adresse], [Ville], [Province], [Code_Postal], [Telephone], [Cellulaire], [Courriel], [Permis_Conduire], [Type_Boisson], [No_Lot], [Date_Depart], [Etape2_nom], [Etape2_date], [Etape3_nom], [Etape3_date], [Etape4_nom], [Etape4_date], [Etape5_nom], [Etape5_date], [Etape6_nom], [Etape6_date], [Etape7_nom], [Etape7_date], [Genre_Boisson], [Notes]) VALUES ( '" & _
DTPicker18 & _
"' , '" & ComClient.Text & ", " & ComNom.Text & "' , '" & address.Text & _
"' , '" & ville.Text & "' , '" & province.Text & _
"' , '" & code_postal.Text & "' ,'" & telephone.Text & _
"' , '" & cellulaire.Text & "' ,'" & courriel.Text & "' , '" & permis_conduire.Text & _
"' , '" & ComType_boisson.Text & "' , '" & lot_boisson.Text & "' , '" & DTPicker18 & _
"' , '" & etape2.Text & "' , '" & IIf(etape2.Text <> "", "[Etape2_date]", "'" & DTPicker19 & "'") & "' , '" & etape3.Text & "' , '" & DTPicker20 & _
"' , '" & etape4.Text & "' , '" & DTPicker21 & "' , '" & etape5.Text & "' , '" & DTPicker22 & _
"' , '" & etape6.Text & "' , '" & DTPicker23 & "' , '" & etape7.Text & "' , '" & DTPicker24 & _
"' , '" & variete_boisson.Text & "' , '" & boisson_note.Text & "' )"
Debug.Print sql 'print the string so as you can make sure all elements come in and all quotes are placed properly
MyConn.Execute sql 'execute then
MyConn.Close
This is the debug.print result:
INSERT INTO DBase_vignoble_personnalise ([Date_of_day], [Client], [Adresse], [Ville], [Province], [Code_Postal], [Telephone], [Cellulaire], [Courriel], [Permis_Conduire], [Type_Boisson], [No_Lot], [Date_Depart], [Etape2_nom], [Etape2_date], [Etape3_nom], [Etape3_date], [Etape4_nom], [Etape4_date], [Etape5_nom], [Etape5_date], [Etape6_nom], [Etape6_date], [Etape7_nom], [Etape7_date], [Genre_Boisson], [Notes]) VALUES ( '2012-01-09' , 'Cruze, John' , 'adress' , 'City' , 'Province' , 'ZIP' ,'tel' , 'cell' ,'email' , '' , 'VIN' , 'lot555' , '2012-01-09' , 'Chaptalisation' , '[Etape2_date]' , 'Fermantation secondaire' , '2012-01-11' , 'Stabilisation et Clarification' , '2012-01-12' , 'Soutirage et Clarification' , '2012-01-13' , 'Embouteillage' , '2012-01-14' , 'Test' , '2012-01-15' , 'Shiraz' , 'Note Filed' )
So i see something here in the "Where" section: '[Etape2_date]'
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|