Urgent help in query (1 Viewer)

Ossama22

Registered User.
Local time
Today, 13:20
Joined
Aug 31, 2018
Messages
52
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 ?
 

Attachments

  • 711196E1-4131-4DB7-89AB-322D53BCE957.jpg
    711196E1-4131-4DB7-89AB-322D53BCE957.jpg
    101.7 KB · Views: 61

Gasman

Enthusiastic Amateur
Local time
Today, 11:20
Joined
Sep 21, 2011
Messages
14,051
You need to set Criteria of CCode to the value of your combo
Use the Builder to get the correct form reference.

HTH
 

Ranman256

Well-known member
Local time
Today, 07:20
Joined
Apr 9, 2015
Messages
4,339
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
 

Ossama22

Registered User.
Local time
Today, 13:20
Joined
Aug 31, 2018
Messages
52
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 ?
 

Attachments

  • 9649F66E-57B1-410B-9E05-BABF8146A978.jpg
    9649F66E-57B1-410B-9E05-BABF8146A978.jpg
    105.2 KB · Views: 57

Ranman256

Well-known member
Local time
Today, 07:20
Joined
Apr 9, 2015
Messages
4,339
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.
 

Ossama22

Registered User.
Local time
Today, 13:20
Joined
Aug 31, 2018
Messages
52
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 .
 

theseus

Registered User.
Local time
Today, 07:20
Joined
Aug 6, 2018
Messages
32
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?
 

JHB

Have been here a while
Local time
Today, 12:20
Joined
Jun 17, 2012
Messages
7,732
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)?
 

Attachments

  • Empty.jpg
    Empty.jpg
    61.9 KB · Views: 148

Ossama22

Registered User.
Local time
Today, 13:20
Joined
Aug 31, 2018
Messages
52
no i mean by empty cells ( Overtime cell) that = 0 , i dont wanna it to appear if it equal zero or it is null
 

Ranman256

Well-known member
Local time
Today, 07:20
Joined
Apr 9, 2015
Messages
4,339
records can disappear, not cells.
you can filter out the nulls/zeros for the whole record.
 

theseus

Registered User.
Local time
Today, 07:20
Joined
Aug 6, 2018
Messages
32
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.
 

Users who are viewing this thread

Top Bottom