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.

Recommended Answers

All 3 Replies

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

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

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 . . .

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.