Hi, I am fairly new to using access and was after a few pointers. I am currently devising a form which I want to be able to dispaly a command button which will (when pressed) output a query TOTAL. I have found it is simple enough to output a query to another form, but I want the text box?? to output the data directly to the form (which has the command button on). If that makes sense.

I have managed to find a similar database from 97 which has a vb statement inc. I have copied the code and made it relevant to my form. When I press this button I get the error "Type mismatch" on screen. Here isd the statement (I have bolded the line it bombs out on):

Private Sub cmdSB_Click()
On Error GoTo Err_cmdSB_Click

Dim stDocName As String
Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("SELECT count(error2) FROM TCLP_PASS1 WHERE error2='SB';")
Debug.Print rst
Me!txtSB = rst!Count
stDocName = "TCLP -SB"
DoCmd.OpenQuery stDocName, acNormal, acEdit



Exit_cmdSB_Click:
Exit Sub

Err_cmdSB_Click:
MsgBox Err.Description
Resume Exit_cmdSB_Click

End Sub

Where TCLP -SB is the query it is connected to and txtSB is the data field.
As I stress I am fairly new and I assumed that this would be a fairly common procedure. Is their a simpler way to accomplish this?????

Ste