473,402 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Having trouble listing car-makes starting with the letter "d"

MLH
Am having trouble with the filter property setting below.
Would like to filter the listing to car makes beginning
with "D". I'm blowing it on the filter spec somehow???

Sub OpenRecordsetX()

Dim MyDB As Database
Dim rstTemp As Recordset
Dim rstTemp2 As Recordset
Set MyDB = CurrentDb()

' Open several different Recordset objects and display the
' contents of each.

Debug.Print "Opening forward-only-type recordset " & _
"where the source is a QueryDef object..."
Set rstTemp = MyDB.OpenRecordset( _
"qryAuthsNvehics", dbOpenForwardOnly)
OpenRecordsetOutput rstTemp

Debug.Print "Opening read-only dynaset-type " & _
"recordset where the source is an SQL statement..."
Set rstTemp = MyDB.OpenRecordset( _
"SELECT * FROM tblAutoMakes", dbOpenDynaset, dbReadOnly)
OpenRecordsetOutput rstTemp

' Use the Filter property to retrieve only certain
' records with the next OpenRecordset call.
Debug.Print "Opening recordset from existing " & _
"Recordset object to filter records..."
rstTemp.Filter = "Make = 'Like D*'"
Set rstTemp2 = rstTemp.OpenRecordset()

OpenRecordsetOutput rstTemp2

Debug.Print "Opening dynamic-type recordset"
Set rstTemp = MyDB.OpenRecordset("SELECT * FROM
PrecisionTuneContacts", dbOpenDynamic)
OpenRecordsetOutput rstTemp

rstTemp.Close
MyDB.Close

End Sub

Apr 10 '06 #1
1 5117
Br
MLH wrote:
Am having trouble with the filter property setting below.
Would like to filter the listing to car makes beginning
with "D". I'm blowing it on the filter spec somehow???

Sub OpenRecordsetX()

Dim MyDB As Database
Dim rstTemp As Recordset
Dim rstTemp2 As Recordset
Set MyDB = CurrentDb()

' Open several different Recordset objects and display the
' contents of each.

Debug.Print "Opening forward-only-type recordset " & _
"where the source is a QueryDef object..."
Set rstTemp = MyDB.OpenRecordset( _
"qryAuthsNvehics", dbOpenForwardOnly)
OpenRecordsetOutput rstTemp

Debug.Print "Opening read-only dynaset-type " & _
"recordset where the source is an SQL statement..."
Set rstTemp = MyDB.OpenRecordset( _
"SELECT * FROM tblAutoMakes", dbOpenDynaset, dbReadOnly)
OpenRecordsetOutput rstTemp

' Use the Filter property to retrieve only certain
' records with the next OpenRecordset call.
Debug.Print "Opening recordset from existing " & _
"Recordset object to filter records..."
rstTemp.Filter = "Make = 'Like D*'"
Set rstTemp2 = rstTemp.OpenRecordset()

OpenRecordsetOutput rstTemp2

Debug.Print "Opening dynamic-type recordset"
Set rstTemp = MyDB.OpenRecordset("SELECT * FROM
PrecisionTuneContacts", dbOpenDynamic)
OpenRecordsetOutput rstTemp

rstTemp.Close
MyDB.Close

End Sub


If it were me I'd just amend the SQL to include a WHERE clause....

SELECT * FROM tblAutoMakes WHERE Make Like "d*"

--
regards,

Br@dley
Apr 10 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Anand | last post by:
Hi i am having trouble adding a recordset into the access database, the code seems to be working fine it passs and parses through all variables just fine without showing any errors and also when i...
2
by: ed | last post by:
i'm having trouble with a form. I want to be able to type in the address of the form with the data for the form items in the URL (ie: http://somesite.com/formpage.html?field1=data1&field2=data2)....
1
by: Lauren Wilson | last post by:
I'm having trouble with the Access VBA help on my installation of A2K with Dev tools. Every time I try to retrieve help for items listed in the Object Browser (and SOME other items as well),...
2
by: Jozef | last post by:
Hello, I am trying to put together a module and open a workspace on a database that has a simple password (using Access XP). This is the lin that I'm having trouble with; Set wrk =...
0
by: Jozef | last post by:
Hello, I'm having trouble with the download links on my web server. The error I'm getting is; CGI Timeout The specified CGI application exceeded the allowed time for processing. The server...
1
by: Jozef | last post by:
Hello. I'm having trouble creating a blank solution (and ASP.net web application) from my laptop. I own the server (in fact it's sitting right next to me) and have added the URL to the trusted...
2
by: Jake Barnes | last post by:
I've read over the documentation for these effects: http://wiki.script.aculo.us/scriptaculous/show/CombinationEffectsDemo I want to include them on my page. I tried attaching using onload, but...
0
by: harry12 | last post by:
Hello- I'm fairly new at using Microsoft Access and I'm having trouble getting a couple of things to work in my database. The first is that I have yet to find a way to get an append query to...
2
by: Stu | last post by:
Hi guys, I've been having trouble getting the clock function to work portably, please could I get some thoughts? <Possibly OT comments> It works fine on my laptop (under WinXP) and on my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.