Access: Forms Combo Box choosing a query

  • Hi Guys,

    I was wondering if there is a way to somehow get a combo box on an access form to do something like the following

    iif([BatchCheck]=True,SELECT [CatalogueNumberStockBatch_Transfer_to_WIP].[SumOfStockQty] FROM CatalogueNumberStockBatch_Transfer_to_WIP;,SELECT [CatalogueNumberStock_Transfer_to_WIP].[SumOfStockQty] FROM CatalogueNumberStock_Transfer_to_WIP;)

    Is this possible, I would love to use just one query to do this but I cannot get it to work if there is a null batch field (ie the query won't return anything)

    I hope this is enough info..



  • Forgive me if I have mis-read your post.

    You seem to be performing the same Query whether or not [BatchCheck] is True.

    Does what you want your query to return depend on the value of [BatchCheck] ?

    If not, why bother with the reference to it at all....just have the query return [SumofStockQuantity]....

    The other thing that confused me was why you wanted to return a single value [SumofStockQuantity] to a Combobox. Surely a textbox would suffice for a single value.

    I'm sorry that attachments aren't working at the mo - Access questions are extremely difficult to answer without being able to refer to the database in question. :(


  • Hi Will,

    There are actually two different queries (could have been a typo). One query works if there is a batch and the other work if there is no batch present.

    I have used a combo box because I don't know how to select a value from a query other than using the recordsource method of the combo box.



Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!