Go Back   Access World Forums > Microsoft Access Discussion > Queries

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 11-08-2018, 02:37 AM   #1
Ossama22
Newly Registered User
 
Join Date: Aug 2018
Posts: 24
Thanks: 1
Thanked 0 Times in 0 Posts
Ossama22 is on a distinguished road
Urgent help in query

Hello guys , i have urgent inquiry , i have a table (attached )
I wanna to create form with combo box , when i select company code , it automatically filter the cells contain the same company code , for example , if i select CCF from my drop list , and go to query , i found the columns with CCF code only , cuz when i try to do that , all headers appeared, which contain the company code also the empty cells which is wrong , so any help guys ?
Attached Images
File Type: jpg 711196E1-4131-4DB7-89AB-322D53BCE957.jpg (101.7 KB, 25 views)

Ossama22 is offline   Reply With Quote
Old 11-08-2018, 02:43 AM   #2
Gasman
Access newbie
 
Join Date: Sep 2011
Location: Swansea, South Wales,UK
Posts: 2,583
Thanks: 308
Thanked 402 Times in 387 Posts
Gasman has a spectacular aura about Gasman has a spectacular aura about
Re: Urgent help in query

You need to set Criteria of CCode to the value of your combo
Use the Builder to get the correct form reference.

HTH
__________________
Access novice. Sometimes trying to give something back.
Access 2007
Gasman is offline   Reply With Quote
Old 11-08-2018, 02:58 AM   #3
Ranman256
Newly Registered User
 
Join Date: Apr 2015
Location: KY,USA
Posts: 3,136
Thanks: 0
Thanked 683 Times in 668 Posts
Ranman256 will become famous soon enough Ranman256 will become famous soon enough
Re: Urgent help in query

in a continuous form, put an unbound combo box, that has the codes. (in the form header)
then when user picks the code, the list filters:

Code:
sub cboBox_Afterupdate()
If IsNull(cboBox) Then
  Me.FilterOn = False
Else
  Me.Filter = "[CCode]='" & cboBox & "'"
  Me.FilterOn = True
End If
end sub

Ranman256 is offline   Reply With Quote
Old 11-08-2018, 03:37 AM   #4
Ossama22
Newly Registered User
 
Join Date: Aug 2018
Posts: 24
Thanks: 1
Thanked 0 Times in 0 Posts
Ossama22 is on a distinguished road
Re: Urgent help in query

Thank you guys for you replies , but i tried the 2 methods that you have mentioned but i still face the same problem , the filter working well , but it still showing the empty cells , is there anyway to avoid that ?
Attached Images
File Type: jpg 9649F66E-57B1-410B-9E05-BABF8146A978.jpg (105.2 KB, 15 views)
Ossama22 is offline   Reply With Quote
Old 11-08-2018, 04:21 AM   #5
Ranman256
Newly Registered User
 
Join Date: Apr 2015
Location: KY,USA
Posts: 3,136
Thanks: 0
Thanked 683 Times in 668 Posts
Ranman256 will become famous soon enough Ranman256 will become famous soon enough
Re: Urgent help in query

there are no empty cell there.
that is space for the next record for you to create.

if you dont not want to add new records, set the query property RECORDSET TYPE= snapshot.
this wont allow new recs and remove the 'new' record space.
Ranman256 is offline   Reply With Quote
Old 11-08-2018, 04:26 AM   #6
Ossama22
Newly Registered User
 
Join Date: Aug 2018
Posts: 24
Thanks: 1
Thanked 0 Times in 0 Posts
Ossama22 is on a distinguished road
Re: Urgent help in query

Quote:
Originally Posted by Ranman256 View Post
there are no empty cell there.
that is space for the next record for you to create.

if you dont not want to add new records, set the query property RECORDSET TYPE= snapshot.
this wont allow new recs and remove the 'new' record space.
I mean by empty cells that the cells that doesn’t contain a company code , (CCF), how can i hide it , in another meaning i want to when i choose company code it shows headers fillling with (CCF) only .
Ossama22 is offline   Reply With Quote
Old 11-08-2018, 09:23 AM   #7
theseus
Newly Registered User
 
Join Date: Aug 2018
Posts: 19
Thanks: 1
Thanked 1 Time in 1 Post
theseus is on a distinguished road
Re: Urgent help in query

You need to set the criteria for the query to only pull the data that matches the combo box field. Something like
Code:
Like [Forms]![CompanyForm]![c-code]
Have you set the query to only pull unique records?

theseus is offline   Reply With Quote
Old 11-08-2018, 12:22 PM   #8
JHB
Have been here a while
 
Join Date: Jun 2012
Location: In the south of Denmark (Jutland), near the German border.
Posts: 7,428
Thanks: 2
Thanked 1,993 Times in 1,949 Posts
JHB has a spectacular aura about JHB has a spectacular aura about
Re: Urgent help in query

Quote:
Originally Posted by Ossama22 View Post
I mean by empty cells that the cells that doesn’t contain a company code , (CCF).
Is the marked row, what you mean by empty cells, (if yes change the query's property "Recordset Type" to Snapshot)?
Attached Images
File Type: jpg Empty.jpg (61.9 KB, 42 views)
__________________
If the above post has helped you, why not take the time to say thank you, by pressing the "Thumbs up."
JHB is offline   Reply With Quote
Old 11-09-2018, 03:11 AM   #9
Ossama22
Newly Registered User
 
Join Date: Aug 2018
Posts: 24
Thanks: 1
Thanked 0 Times in 0 Posts
Ossama22 is on a distinguished road
Re: Urgent help in query

no i mean by empty cells ( Overtime cell) that = 0 , i dont wanna it to appear if it equal zero or it is null
Ossama22 is offline   Reply With Quote
Old 11-09-2018, 04:58 AM   #10
Ranman256
Newly Registered User
 
Join Date: Apr 2015
Location: KY,USA
Posts: 3,136
Thanks: 0
Thanked 683 Times in 668 Posts
Ranman256 will become famous soon enough Ranman256 will become famous soon enough
Re: Urgent help in query

records can disappear, not cells.
you can filter out the nulls/zeros for the whole record.
Ranman256 is offline   Reply With Quote
Old 11-09-2018, 05:26 AM   #11
theseus
Newly Registered User
 
Join Date: Aug 2018
Posts: 19
Thanks: 1
Thanked 1 Time in 1 Post
theseus is on a distinguished road
Re: Urgent help in query

I still think Gasman and I are correct. Criteria needs to be set to only match the combo box selection. It is a very easy process.

theseus is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Urgent urgent help needed for newbie flood victim! Floodgirl Reports 2 09-24-2008 04:53 AM
Urgent help for a SQL query Notsogood SQL Server 3 03-19-2007 06:47 AM
Urgent help for a SQL query Notsogood Queries 4 03-16-2007 01:32 AM
Urgent help on a Query Hazel Queries 2 04-01-2005 02:06 PM
urgent query help janed Queries 13 02-15-2002 06:30 AM




All times are GMT -8. The time now is 06:56 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World