hi, im having problem with my current project which is to insert values from variable into fields in access database. i know how to insert values from textbox into access but im having problem using variables.can anyone please help me?

Hi,

Check This:

dim TextVar As String
Dim NumbVar As Currency
Dim DateVar As Date
Dim sSQL As String
 
sSQL = "Insert Into MyTable(TextField,NumbFld,DateFld) Values ('" & TextVar & "' , " & NumbVar & ", #" & DateVar & "#) "
AConn.Execute sSQL

REgards
Veena

veena, thanx for the reply.but i am currently using adodc to connect to the database.my codes are as follow:

'if inserting values from textbox,it will be
Adodc1.Recordset.Fields("Booking_Time").Value = Txt_Time.Text

'i tried using this to insert values from variables into database
Dim time As String
................. 
.................
Adodc1.Recordset.Fields("Booking_Time").Value = time

is there any possible way for me to blend in your codes into the use of adodc?

veena. i hv gotten it. it was actually a mistake on the arrangement of codes.thanx so much for your help n concern.really appreciate it.
thanx again :))

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.