473,421 Members | 1,469 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,421 software developers and data experts.

How to get the filter string from a subform tied to a query

2
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the filter string once the user filters the query though the subform and use it to create a temp query that populates a report of the filtered data. Here is the VBA I've been trying:

Private Sub cmdPrint_Click()

Dim sSQL As String

sSQL = "Select * From tblDiceInventory"

If Len(Me.Filter) > 0 Then
sSQL = sSQL & " Where " & Me.Filter
End If

If Len(Me.OrderBy) > 0 Then
sSQL = sSQL & " Order By tblDiceInventory.Customer Name"
End If

Call DBEngine.Workspaces(0).Databases(0).CreateQueryDef ("qryFilter", sSQL)

DoCmd.OpenReport "rptdiceinventory", acViewPreview, , strFilter
End Sub
Thoughts anyone...thanks inadvance
Jan 19 '24 #1
0 19690

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Salad | last post by:
I have a log file with a list of records. The log file can be unfiltered or filtered. I have a command button to call a data entry form from the log. At first I was only going to present the...
1
by: jjchristiansen | last post by:
I have a form in which I am trying to filter a query using up to 6 combo bixes. The problem is, unless all 6 combo boxes are selected properly, nothing will apear in the Subform. I would like...
2
by: istorehere | last post by:
Hi there, I have created a subform with query. but it doesnt allows me to add/edit records. i have two tables. Items : Item_code,ItemDesc,Reference Order : Orderno,Item_code,Qty
2
by: jcharth | last post by:
Hello How can i add 1 to a string in a query, is there somethig like char to int in sql? thanks.
1
by: kinglioness | last post by:
Hello All, I am new to this forum so I apologize if this quesiton was asked already. Although i did search but i couldn't find. I have 2 combo boxes one unbound and the other bound they are on...
1
by: woodey2002 | last post by:
Hi Everyone and many thanks for your time.. I am trying to begin access and a bit of VBA i am enjoying it but I have a annoying problem I just can’t get any where on. My databse mostly includes...
3
by: charli | last post by:
Is it possible to programmatically get the sql string of a query object?
2
by: cluless | last post by:
I'm relatively new to access, and I'm trying to create a form where if I click on a selection of a list box the subform below it will be filtered automatically on click (I was hoping I didn't need a...
4
by: kcropper | last post by:
Hi, I’ve been trolling these forums for a while now, and while I’ve found other related threads (e.g., http://bytes.com/topic/access/answers/702416-search-code-how-filter-using-code-sql), nothing has...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.