Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing all records! 1

Status
Not open for further replies.

rickyoswaldiow

Programmer
Jul 16, 2007
127
GB
I've got a VB form with a combo box which populates with a list of "Warehouses", when I select one it in turn populates another combo box with a list of "Items". I can then go ahead and create a report based on these selections - What is required now is a check box next to the "Warehouses" combo box labled "All", as in you can select all of the warehouses. When the "All" checkbox is clicks, the "Warehouses" combo is cleared so it has no text string displayed.
I am not very good with the SQL side of things and the code I am using was generated by someone else in the office, at the moment it states
Code:
tblParts_ReOrder.WarehouseIDFor = " & lngWarehouseID
where lngWarehouseID is a value passed into the function from the combo box.

I thought that possibly, instead of setting the "Warehouses" combo box string to "", I could set it to "*", which in other places denotes "All". But this does not work. Any suggestions?
 
You cannot have =*, it must be Like *, or simply leave out the line when all is checked.
 
/me needs an SQL book.

I've got the lead programmer helping me out on this now, thanks for the help though :)

 
I know this is hardly the place but, do you know where I can find some good online SQL tutorials relating to Access2002/VBA?
 
 
what i would do is put this a s the SQL for the Warehouses combo

Code:
Select 0,"--All Warehouses--"
Select WarehousesID,WarehousesName
from  tblWarehouses

and this the Sql for the items combo

Code:
Select .......
from  tblParts_ReOrder
where tblParts_ReOrder.WarehouseIDFor=iif(lngWarehouseID=0,tblParts_ReOrder.WarehouseIDFor,lngWarehouseID)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top