Re: Unbound Textbox with Parameter Query
- From: banem2@xxxxxxxxx
- Date: Thu, 5 Jun 2008 01:26:18 -0700 (PDT)
On Jun 5, 3:41 am, mindlike <mindl...@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
I have an unbound textbox "txtTicker" in a form where I would like to enter a
ticker ie. "IBM" to pull a rating "SchwabGrade" from a table "Model Data"
into another textbox "txtSER". The table is in L:"\Member\EventData.mdb"
I'm using this code below to try and do it: I continue to get the error:
Run time error 3061. Too few parameters. Expected 1. Seen lots of commentary
on the web about this error, but none that address my situation. Could
someone please help.
Set dbs = OpenDatabase("L:\Member\EventData.mdb")
Set rst = dbs.OpenRecordset("PARAMETERS " & Me.txtTicker & " Text(255);
SELECT [Model Data].SchwabGrade FROM [Model Data] WHERE ((([Model
Data].CompanySymbol) = " & Me.txtTicker & "))")
tickerField = rst
Me.txtSER = tickerField
dbs.Close
thanks in advance for any help
--
Michael
Air code bellow, if there are errors you could probably solve it
easily. You need to define Parameter, like:
Dim qdf As DAO.QueryDef
Dim rst As DAO.Recordset
Dim dbs As DAO.Database
Set dbs = OpenDatabase("L:\Member\EventData.mdb")
Set qdf = dbs.QueryDefs("PARAMETERS " & Me.txtTicker & " Text(255);
SELECT [Model Data].SchwabGrade FROM [Model Data] WHERE ((([Model
Data].CompanySymbol) = " & Me.txtTicker & "))")
qdf.Parameters(0) = Me.txtTicker
Set rst = qdf.OpenRecordset
tickerField = rst
Me.txtSER = tickerField
dbs.Close
There are many posts about "Too few parameters" error around, so you
can find similar answers.
Regards,
Branislav Mihaljev
Microsoft Access MVP
.
- Follow-Ups:
- Re: Unbound Textbox with Parameter Query
- From: mindlike
- Re: Unbound Textbox with Parameter Query
- Prev by Date: RE: Expression to collate text in a SubForm column
- Next by Date: Re: How to run VBA code on all rows of a table
- Previous by thread: RE: Expression to collate text in a SubForm column
- Next by thread: Re: Unbound Textbox with Parameter Query
- Index(es):
Relevant Pages
|