A
Alain
Hello,
I am trying to write some code to be able to modify a recordset based on 2
criteria but I'm always getting errors like "no value given for one or more
required parameters".
I have tried different way to find the required recordset but no success.
If I use the .find method thje error I get is "Rowset does not support
scrolling backward"
This is the firat time I am using the ADO and SQL in hard code
Can enyone help me trying to understand my problem
Here is my code:
Dim Rst As ADODB.Recordset
Set Rst = New ADODB.Recordset
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
Dim num As Integer
Dim val As Double
Dim strSQL As String, var As String
num = Forms!Budget!IdBranch
val = Me.Avril
var = "Other Exp"
Rst.ActiveConnection = CurrentProject.Connection
Rst.Open "SELECT * FROM Budget"
'WHERE Budget.IdBranch = Forms!Budget!IdBranch"
'AND budget.Variante = var"
strSQL = "[IdBranch] = " & num
'strSQL = strSQL & " AND "
'strSQL = strSQL & "[Variante] = " & var
Rst.MoveFirst
Rst.Find strSQL
With Rst
.Open
Avril = val
Total = Janvier + Fevrier + Mars + Avril + Mai + Juin + Juillet _
+ Aout + Septembre + Octobre + Novembre + Decembre
.Save
End With
Rst.Close
Set Rst = Nothing
conn.Close
Set conn = Nothing
Thanks
I am trying to write some code to be able to modify a recordset based on 2
criteria but I'm always getting errors like "no value given for one or more
required parameters".
I have tried different way to find the required recordset but no success.
If I use the .find method thje error I get is "Rowset does not support
scrolling backward"
This is the firat time I am using the ADO and SQL in hard code
Can enyone help me trying to understand my problem
Here is my code:
Dim Rst As ADODB.Recordset
Set Rst = New ADODB.Recordset
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
Dim num As Integer
Dim val As Double
Dim strSQL As String, var As String
num = Forms!Budget!IdBranch
val = Me.Avril
var = "Other Exp"
Rst.ActiveConnection = CurrentProject.Connection
Rst.Open "SELECT * FROM Budget"
'WHERE Budget.IdBranch = Forms!Budget!IdBranch"
'AND budget.Variante = var"
strSQL = "[IdBranch] = " & num
'strSQL = strSQL & " AND "
'strSQL = strSQL & "[Variante] = " & var
Rst.MoveFirst
Rst.Find strSQL
With Rst
.Open
Avril = val
Total = Janvier + Fevrier + Mars + Avril + Mai + Juin + Juillet _
+ Aout + Septembre + Octobre + Novembre + Decembre
.Save
End With
Rst.Close
Set Rst = Nothing
conn.Close
Set conn = Nothing
Thanks