Urgent help in query

Ossama22

Registered User.
Local time
Today, 23:57
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: 102
You need to set Criteria of CCode to the value of your combo
Use the Builder to get the correct form reference.

HTH
 
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
 
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: 95
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.
 
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 .
 
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?
 
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)?
attachment.php
 

Attachments

  • Empty.jpg
    Empty.jpg
    61.9 KB · Views: 194
no i mean by empty cells ( Overtime cell) that = 0 , i dont wanna it to appear if it equal zero or it is null
 
records can disappear, not cells.
you can filter out the nulls/zeros for the whole record.
 
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

Back
Top Bottom