Newbie help with SQL & ADO

A

Alain

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
 
D

Dirk Goldgar

Answered in the .formscoding newsgroup, where you posted this same
question independently.. That's called "multiposting", and it's
generally frowned on because others don't know what answers have already
been given, and so they duplicate the effort. Also it's harder for you
to keep track of the various replies, and it's harder for later readers
of the question, who may be looking for the same answer, to learn what
they need.

In most cases a single, well-chosen newsgroup will do. If your question
really is relevant to more than one newsgroup, the approved technique is
to "crosspost" it instead, by listing multiple newsgroups in the To: or
Newsgroups: line of a single message. If you do that, the message and
any replies will appear in all the listed newsgroups automatically,
which is beneficial to all concerned.
 
T

Tim Ferguson

Answered in the .formscoding newsgroup, where you posted this same
question independently..

It's been answered in this group too, where it's known as repeat
posting.. :)

B Wishes


Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

SQL syntax and ADO 1
Newbie with SQL & ADO 1
Using ADO 2
ado issue 0
Please help with ADO Code 5
Need help opening ADO recordset. 14
ADO Recordset 1
Help with Excel UserForm 2

Top