Brett Barabash
BBarabash at TappeConstruction.com
Wed Nov 5 08:17:09 CST 2003
The query engine doesn't know what [Forms]![frmAssesments]![txtResultID] means. You can either do: Dim prm As Parameter For Each prm in rs.Parameters prm.Value = Eval(prm.Name) Next prm Or... (preferred method) Just concatenate the control's value into the SQL string so it doesn't need to be parsed: strSQL = "SELECT tblAssesmentResults.AssesmentResultID, tblAssesmentResults.ResultID FROM tblAssesmentResults WHERE (((tblAssesmentResults.ResultID)=" & Forms!frmAssesments!txtResultID & "));" Either way should give you the results you want. -----Original Message----- From: Rocky Smolin - Beach Access Software [mailto:bchacc at san.rr.com] Sent: Tuesday, November 04, 2003 11:08 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] A2K: Too Few Paramaters. Expected 1 Darren: Can't see why offhand but I would put MsgBox "*" & [Forms]![frmAssesments]![txtResultID] & "*" right before the Set rs statement to see if there's a valid value for the ID coming from the form. Or put MsgBox strSQL right before the Set rs statement to see the whole thing. Sometimes it shows up a little syntax error that I just can't see looking at the code. Also do you think you might have to surround the [Forms]![frmAssesments]![txtResultID] with Val(), like Val([Forms]![frmAssesments]![txtResultID]))? Just a guess. Rocky ----- Original Message ----- From: "Darren DICK" <d.dick at uws.edu.au> To: "AccessD List" <AccessD at databaseadvisors.com> Sent: Tuesday, November 04, 2003 8:07 PM Subject: [AccessD] A2K: Too Few Paramaters. Expected 1 > Hello all > Can anyone tell me why I am getting the dreaded Too Few Paramaters blah blah blah error message when > I run the code below?? The code is almast exact of something else that is running quite well on the same form. > > Many thanks > > Darren > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>. > Dim db As Database > Dim rs As Recordset > Dim strSQL As String > Dim x As Long > > Set db = CurrentDb() > > strSQL = "SELECT tblAssesmentResults.AssesmentResultID, tblAssesmentResults.ResultID FROM tblAssesmentResults WHERE > (((tblAssesmentResults.ResultID)=[Forms]![frmAssesments]![txtResultID]));" > > Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot) > > With rs > 'If Not .EOF Then > x = rs.RecordCount > MsgBox x > 'End If > .Close > End With > > Set rs = Nothing > db.Close > Set db = Nothing > > > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -------------------------------------------------------------------------------------------------------------------- This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the originator of the message. This footer also confirms that this email message has been scanned for the presence of computer viruses. Any views expressed in this message are those of the individual sender, except where the sender specifies and with authority, states them to be the views of Tappe Construction Co. Scanning of this message and addition of this footer is performed by SurfControl E-mail Filter software in conjunction with virus detection software.