1.11M Members

Ms Access Combine day,month and time into single field

 
0
 

Hi,

I have an access database where in i have 3 separate fields for day, month and year which are comboboxes. I have an separate field where i need to combine these 3 fields into that single field(dd/mm/yyyy). can somebody help me on this please.

 
0
 

Try the following -

Dim xYear As Integer, xMonth As Integer, xDay As Integer, xResult as String

xYear = rs!year ''Change rs to your record selector name...
xMonth = rs!month ''Also change the field names year, month, day to your field names...
xDay = rs!day

xResult = xDay & "/" & xMonth & "/" & xYear

MsgBox xResult
 
0
 

Can you please guide me as to where this code should appear. Something like in on update field or on change... thanks

 
0
 

try the following:-

Dim dt1 As String
dt1 = Combo1.Text & "/" & Combo2.Text & "/" & Combo3.Text
con.Provider = "Microsoft.Jet.OLEDB.4.0"
con.Open App.Path & "\db.mdb"
con.Execute  "INSERT INTO tbl(dtfield) VALUES('" & dt1 & "')", adCmdText
con.Close
Set con = Nothing

if still not answered , then please make your thread more clear else mark this post as solved . . .

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article