473,473 Members | 2,193 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Subform is not displaying records based on the criteria after clicking command button

3 New Member
Can someone help me on my issues please. I am new to access vba

I have a form named: frmEarlyWarningSystem
SubForm: frmEarlyWarningSystemSubForm
Combox in the mainform: cboLOB

The subform is created using an existing table but then I deleted the Record Source of it because I want to set the Record Source after I click a button and the criteria is based on the combo box. but After Clicking the button, it shows no records. Here is my code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdGo_Click()
  2. Dim strSQL As String
  3.  
  4. strSQL = "SELECT [Priority],[As_Of],[LOB],[Employee_SID],[Employee_Full_Name],[Level_II_Manager_Full_Name],[Level_I_Manager_Full_Name] from [Priority] WHERE [LOB] = '" & [Forms]![frmEarlyWarningSystem]![cboLOB] & "'"
  5.  
  6. With Forms![frmEarlyWarningSystem]![frmEarlyWarningSystemSubForm]
  7.       .Form.RecordSource = strSQL
  8.          .Requery
  9. End With
  10.  
  11. End Sub
I made a research already about my issue but then still no luck.

Your help is very much appreciated!

tia
Apr 6 '13 #1
1 1017
nico5038
3,080 Recognized Expert Specialist
I would start with placing a breakpoint (click left ruler to get a dot) in the code for the strSQL.
Then activate the window and press the button.
The debugger will kick in and show the code.
Next press F8 (single step in debugging) and type in the Immediate window (normally at the bottom, but you could have to activate in from the menu):
?strSQL
and press ENTER.
This will show the query text.
Finally copy/paste the query text in a new query and run it to see the result.

Some possible problems are a LOB field being numeric while you add ' s around it (text datatype) or leading or trailing blanks..

Nic;o)
Apr 7 '13 #2

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

Similar topics

3
by: C White | last post by:
got another one for you guys out there, and thanks again for the help with my "counting question" this time i'm looking to select records based on date, the database stores the date as...
2
by: SomeDude | last post by:
Lo group, I would like to know if it is possible to a (string) replace on existing records based on a given pattern. Let's say I have a table containing the following records (strings):...
11
by: Matt | last post by:
Hi everyone, still pretty new to MySQL. I was wondering if there is a way to automatically filter records based on a mysql userlogin name?? I have serveral databases that I want to combine in...
2
by: Kelly | last post by:
I have a subform that display requisition information. One of the fields in the subform is a combo box that shows who requested the requisition. The users can change who requested the requisition...
1
by: arthur-e | last post by:
How can you select records based on more than one combo box - I have a combobox that selects records based on name (I'm sure this has been asked a thousand times - web site answer/link could be...
0
by: Fronky | last post by:
Hope someone can help. I am still learning, so no laughing please. I am displaying records from a database using Response.Write(""); instead of the usual datagrid method. I am doing it this way...
0
by: John Kirkpatrick | last post by:
Hi all, I am having difficulty displaying records on a frontend MS Access 2000 form using a MySQL backend. The following code works well with the Jet database engine but doesn't work properly...
5
by: sejal17 | last post by:
hello everyone, I have a problem with displaying records between two dates.Below is my designing page: start date: combobox of month(smonth) & combobox of year(syear) end date :...
6
by: BEETHOVEN | last post by:
I have an option group called Issue_Type on my main form F1_Member_Demographics_Main. When I select one of the 3 options on the main form from the option group Issue_Type I want to limit the sub...
1
by: santhosh309 | last post by:
iam displaying records in gridview,now my requirement is based on the transaction i want to show that rows in a different colour
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,...
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,...
1
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.