Hi I have the following database connection and mysql in my project.
Public myConnection As ADODB.Connection
Dim rs As New ADODB.Recordset
Public Function Get_My_Connection() As ADODB.Connection
If myConnection Is Nothing Then
Set myConnection = New ADODB.Connection
myConnection.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Documents and Settings\andy\Desktop\Production\Planner.accdb;Persist Security Info=False;"
Set Get_My_Connection = myConnection
mysql = "#" & Format(datFriday, "yyyy-mm-dd") & "#"
= " SELECT Atherstone, Chelmsford, Darlington, Neston, Swindon, DailyTotal" _
& " FROM Actualorders " _
& " WHERE Actualorders.[Date] Between" & mysql & " " & -7 & " And " & mysql
.LockType = 2
.CursorType = 3
.Open mysql, Get_My_Connection
If .RecordCount > 0 Then
txtATHest.Text = .Fields("Atherstone")
txtCHELest.Text = .Fields("Chelmsford")
txtDARLest.Text = .Fields("Darlington")
txtNESest.Text = .Fields("Neston")
txtSWINest.Text = .Fields("Swindon")
txtESTtotal.Text = .Fields("DailyTotal")
Set rs = Nothing
This works fine as it takes a value from my database from 7 days previous and then places it in a txtbox I use this value as an estimate.
Next to these txtboxs I have further txtboxs which I enter the actual value for that day
Now I want to save the values I enter into the actual values txtboxs to the same database I am viewing the values from the previous 7 days.
I have tried using an INSERT INTO which works but at times I will have a 0 in the txtbox and will need to save it(which it wont let me) and then I need to able to move back to that day and edit the zero cells when I have the actual figures.
Hope someone can understand this as quite hard to explain.