Re: textbox controsource as recordset field
- From: Marshall Barton <marshbarton@xxxxxxxxxx>
- Date: Mon, 09 May 2005 21:47:08 -0500
RedFish wrote:
>I'm a newbie to Access 2000, trying to set up a report here. I'm creating a
>recordset with a query, and want to assign the result to a textbox on the
>report. I've obviously got something wrong.
>
>'lcImport is defined by getting the result of a different query, on my
>import map.
>lcSelect = "SELECT [" & lcImport & "] AS myfield FROM MyTable1 WHERE [" &
>lcImport & "] NOT IN ( SELECT myfield FROM MyTable2 )"
>Set rstCD = dbs.OpenRecordset(lcSelect)
>
>Me.txtCD.ControlSource = rstCD.Fields("myfield")
>
>This results in a type mismatch, and I just don't know enough about how
>Access works to figure out why.
Aside from a potential name confusion of "myfield", I think
there is a very obscure thing going on here. If I am
interpreting your code correctly, I think the problem may
arise when the query does not return any records. You
should check the recordset's RecordCount property to make
sure it's greater than zero and add some code to deal with
the case when it is zero?
--
Marsh
MVP [MS Access]
.
- Follow-Ups:
- Re: textbox controsource as recordset field
- From: RedFish
- Re: textbox controsource as recordset field
- References:
- textbox controsource as recordset field
- From: RedFish
- textbox controsource as recordset field
- Prev by Date: Re: Coditional formatting
- Next by Date: Re: Sum a time on a Rpt
- Previous by thread: textbox controsource as recordset field
- Next by thread: Re: textbox controsource as recordset field
- Index(es):
Relevant Pages
|