|
-
January 9th, 2012, 11:06 AM
#1
Transfer date to access dbase if issue
Hello all
I'm trying to build this code so that it transfer all information into my Microsoft Access dBase.
The problem is with this part of the code where i want to says these:
1) If there is nothing in etape2.Text, i dont want to save DTPicker19 in access.
2) If there is nothing in etape3.Text, i dont want to save DTPicker20 in access.
3) If there is nothing in etape4.Text, i dont want to save DTPicker21 in access.
4) If there is nothing in etape5.Text, i dont want to save DTPicker22 in access.
5) If there is nothing in etape6.Text, i dont want to save DTPicker23 in access.
6) If there is nothing in etape7.Text, i dont want to save DTPicker24 in access.
When i do a test with only the first statement, the error i have is: run time error 2417217900(80040e14)
Syntax error (missing operator) in query expression ‘Description=operator’s current stats”.
Code:
IIf(etape2.Text <> "", "[Etape2_date]", "'" & DTPicker19 & "'")
Can you please help me?
Thanks again
FULL code
Code:
'Insert data in Microsoft Access Data Base
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
Set MyRecSet1 = MyConn.Execute( _
"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 & "' )")
MyConn.Close
Last edited by wilder1926; January 9th, 2012 at 11:09 AM.
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
|