how to store the month and year in the same field in the database using a query....i have a query which stores current month and year in the different fields.... but i want to store in the form october2007 or 10/2007
[code=vb]
Private Sub cmdAdd_Click()
Dim m As String
Dim y As String
Dim d As Date
d = Now()
m = MonthName(Month (Now))
y = Year(Now)
With AConn
.ConnectionStri ng = "Provider=Micro soft.jet.OLEDB. 4.0;Data Source=E:\Graph \Graph\xpence.m db"
.Open
End With
sSQL = "INSERT INTO Table1(TodayDat e,MonthName,Yea rValues,Amount, Description) " & _
" Values (# " & Format(d, "dd/mm/yyyy") & " #,' " & m & " ',' " & y & " ', ' " & Text3.Text & " ', ' " & Text2.Text & " ') "
AConn.BeginTran s
AConn.Execute sSQL
AConn.CommitTra ns
AConn.Close
End Sub
[/code]
this is the query ...what changes should made to obtain monthyear form......
using vb6.0 and backend is access
[code=vb]
Private Sub cmdAdd_Click()
Dim m As String
Dim y As String
Dim d As Date
d = Now()
m = MonthName(Month (Now))
y = Year(Now)
With AConn
.ConnectionStri ng = "Provider=Micro soft.jet.OLEDB. 4.0;Data Source=E:\Graph \Graph\xpence.m db"
.Open
End With
sSQL = "INSERT INTO Table1(TodayDat e,MonthName,Yea rValues,Amount, Description) " & _
" Values (# " & Format(d, "dd/mm/yyyy") & " #,' " & m & " ',' " & y & " ', ' " & Text3.Text & " ', ' " & Text2.Text & " ') "
AConn.BeginTran s
AConn.Execute sSQL
AConn.CommitTra ns
AConn.Close
End Sub
[/code]
this is the query ...what changes should made to obtain monthyear form......
using vb6.0 and backend is access
Comment