Re: Default Text for an Empty returned recordset
- From: "ricky" <ricky@xxxxxxxxx>
- Date: Thu, 9 Nov 2006 11:24:03 -0000
Hi Klatuu
Unfortunately, I have inherited this project from someone who has left the
company and lets just say VBA is not my forte. Thank you for the code
posting, I'll try it out.
Kind Regards
Ricky
"Klatuu" <Klatuu@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:8A52A891-E87E-4902-8797-98FB9B3025D3@xxxxxxxxxxxxxxxx
First, rather than have the user enter to parameter value in the query,put a
text box on your form and have them enter it there. Then, open the queryas
a recordset and test the recordcount property. If it returns 0, notrecords
are returned.user
Change the criteria in your query to reference the control the user where
the user will enter the criteria
Forms!MyFormName!txtSearchValue
Dim dbf As Database
Dim rst As Recordset
Dim qdf as Querydef
Dim lngRecords As Long
Set dbf = Currentdb
Set qdf = dbf.Querydefs("MyQueryNameHere")
qdf.Parameters(0) = Me.txtSearchValue
Set rst = qdf.OpenRecordset(dbOpenSnapshot, dbReadOnly)
lngRecords = rst.RecordCount
rst.Close
Set rst = Nothing
Set qdf = Nothing
Set dbf = Nothing
If lngRecords < 1 Then
MsgBox "No Records Found"
Else
'Do whatever you want with the query
End If
rst.MoveLast
rst.Close
set rst = nothing
set dbf = nothing
"ricky" wrote:
Hi
I have a query executed from a command button. The query prompts the
placeto supply a variable. If the variable returns no data, how would I
some default text to tell the user nothing has been returned.
Kind Regards
Ricky
.
- Follow-Ups:
- Re: Default Text for an Empty returned recordset
- From: Klatuu
- Re: Default Text for an Empty returned recordset
- References:
- Default Text for an Empty returned recordset
- From: ricky
- Default Text for an Empty returned recordset
- Prev by Date: scrollbar tooltip?
- Next by Date: Re: Runtime error 2001 (sending email)
- Previous by thread: Re: Default Text for an Empty returned recordset
- Next by thread: Re: Default Text for an Empty returned recordset
- Index(es):