Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Too few parameters. Expected 1.

Status
Not open for further replies.

darinmc

Technical User
Feb 27, 2005
171
GB
Hi
I have this code which works perfectly if I manually type a number in
e.g. if VarReg = 2 and i type this instead of varReg it works
ELSE i get the error... have looked at similar errors and tried a few things BUT STILL GIVING ME TROUBLE....

Code:
Dim VarReg as Integer

VarReg = [Forms]![frmPassword]![tReg]
Set rst2 = dbs.OpenRecordset("SELECT tblDiary.DiaryID, tblDiary.RegNo, tblDiary.ReadDiary, tblDiary.MsgTo FROM tblDiary WHERE (((tblDiary.RegNo) = [Forms]![frmPassword]![tReg]) And ((tblDiary.ReadDiary) = 0)) ORDER BY tblDiary.MsgTo")

If rst2.RecordCount > 0 Then
MsgBox "you have mail"
End If

Could someone PLEASE please help...
ALSO, in the msgbox,
Instead of just saying you have mail, is there a way to show how many records were counted???

Thx
Darin
 
Sorry, in the code i have place the variable VarReg, still same error...

[Forms]![frmPassword]![tReg]

thx
Darin
 
Code:
...
Set rst2 = dbs.OpenRecordset("SELECT DiaryID, RegNo, ReadDiary, MsgTo FROM tblDiary" _
 & " WHERE RegNo=" & VarReg & " AND ReadDiary=0 ORDER BY MsgTo")
...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
thanks
That worked perfectly...
I also got it to show on the msgbox

msgbox "you have " & VarRecCount & " Message(s)"

Thx
Darin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top