n1a2v3i3n
Programmer
- Jan 19, 2009
- 18
I have tried inserting date using Combobox (which was posted previously) Now i would like to use text box to insert date and then retrive baxk from the access database. I tried as follows:
Dim Adodc1 As New ADODB.Recordset
Dim str As String
Dim da As Date
Dim ans As String
Dim d As String
str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
App.Path & "\Ecmdetail.mdb;Persist Security Info=False"
Adodc1.Open " select * from ecm ", str, adOpenDynamic, adLockOptimistic
da = Format(Text1.Text, "dd/mm/yy")
Adodc1.Find "ecmserial like '" & txtecmsno & "'"
If Adodc1.EOF Then
With Adodc1
.AddNew
MsgBox " Date is " & da
!daterem = da
MsgBox " Date retrived from database is " & !daterem
!vechno = txtvecno
!ecmserial = txtecmsno
!ECMpart = txtecmpno
!fault = txtflt
!Condition = Comcon
.Update
.Requery
End With
Here the date is being inserted for example i am entering 27/01/09, while it is saved as 01/09/2027.
Could any one tell wht is the problem
Dim Adodc1 As New ADODB.Recordset
Dim str As String
Dim da As Date
Dim ans As String
Dim d As String
str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
App.Path & "\Ecmdetail.mdb;Persist Security Info=False"
Adodc1.Open " select * from ecm ", str, adOpenDynamic, adLockOptimistic
da = Format(Text1.Text, "dd/mm/yy")
Adodc1.Find "ecmserial like '" & txtecmsno & "'"
If Adodc1.EOF Then
With Adodc1
.AddNew
MsgBox " Date is " & da
!daterem = da
MsgBox " Date retrived from database is " & !daterem
!vechno = txtvecno
!ecmserial = txtecmsno
!ECMpart = txtecmpno
!fault = txtflt
!Condition = Comcon
.Update
.Requery
End With
Here the date is being inserted for example i am entering 27/01/09, while it is saved as 01/09/2027.
Could any one tell wht is the problem