MsAcess ADO and DOA coding

G

Guest

I want to get the total sum up of annual approved budget relating to 3 fields
from Budget entry form to budget analysis field (txtannlapprvbudg). I have
used following codes.

Private Sub txtapprvbudg_GotFocus()
Dim strfind As String

With rsbe
.FindFirst (strfind)
If rsbe.NoMatch = False Then

txtapprvbudg.Value = "select sum([Annual Approved Budget]) into val from
tblBudget where [Project No]='" & Me![cmbprojno] & "' and [Activity Code]='"
& Me![cmbactcode] & "' and [Objective Code]='" & Me![cmbobjcode] & " ' and
[Donor]='" & Me![cmbdonorcode] & "'"



With rsbe
.FindFirst (strfind)
If rsbe.NoMatch = False Then
txtapprvbudg.Value = "select sum([Annual Approved Budget]) into val from
tblBudget where [Project No]='" & Me![cmbprojno] & "' and [Activity Code]='"
& Me![cmbactcode] & "' and [Objective Code]='" & Me![cmbobjcode] & " ' and
[Donor]='" & Me![cmbdonorcode] & "'"

Else
MsgBox "Sorry the Code does not exist, reenter the Codes again.",
vbInformation, "FEMIS SYSTEMS : Activity Code"

cmbprojno.SetFocus
cmbprojno.Value = ""
cmbdonorcode.Value = ""
cmbactcode.Value = ""
cmbobjcode.Value = ""

End If
End With
Could you please advice me on this coding.

Thank you very much and waiting for your answer.

Binod
 

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

Top