More questions for my database

T

Todd

What I have is a tool inventory database and what I need to do is when an
order has been placed to check out some tools, I need to make those tools
unavailable. I have a form with a subform and the list of available are in a
combo box. So in that combo box is where I need to show only the tools that
are available. . Not sure just what to do to make that happen.

Thanks for the help
Todd
 
D

Dirk Goldgar

Todd said:
What I have is a tool inventory database and what I need to do is
when an order has been placed to check out some tools, I need to
make those tools unavailable. I have a form with a subform and the
list of available are in a combo box. So in that combo box is where
I need to show only the tools that are available. . Not sure just
what to do to make that happen.

How is the database to know that a tool has been checked out? What
table structure represents that information? Knowing that, you should
be able to build a query that extracts only those tools that have not
been checked out, and use that query as the rowsource for your combo
box. Then whenever a tool is checked out, requery the combo box.
 
T

Todd

As it stands now I have a yes/no box for both IN and OUT. What I wanted to
do is to when they click on the submit button it would delete the check in
the IN box and place the check in the OUT box. That's where I'm running
into the problem. How do I make that change?

Todd
 
D

Dirk Goldgar

Todd said:
As it stands now I have a yes/no box for both IN and OUT. What I
wanted to do is to when they click on the submit button it would
delete the check in the IN box and place the check in the OUT box.
That's where I'm running into the problem. How do I make that change?

I'm curious. Is it possible for a tool to be neither IN nor OUT? If
not (which makes sense to me), then why have two check boxes, bound to
two fields? Why not have just one field, either IN or OUT? If you
really want both an IN and an OUT control on the form, you could use an
option group containing two check boxes or radio buttons, such that
which box/button is checked/selected reflects the current value of the
option group.

I recognize that this isn't answering your original question, but the
final answer to that question is going to depend ultimately on the table
structure.
 
G

Garret

Just wondering to what you were saying before about requerying the
combo box - if the combo box uses its rowsource property as a certain
query, will it update automatically if that query changes?
 
R

Rick Brandt

Garret said:
Just wondering to what you were saying before about requerying the
combo box - if the combo box uses its rowsource property as a certain
query, will it update automatically if that query changes?

No. Not if the form it is on is already opened.

Me.ComboBoxName.Requery
 
G

Garret

Is the "Me." suffix necessary? I never really knew what the Me keyword
did exactly, or which contexts it can be used in. I've only ever seen
it in code examples without an explanation.
 
R

Rick Brandt

Garret said:
Is the "Me." suffix necessary? I never really knew what the Me keyword
did exactly, or which contexts it can be used in. I've only ever seen
it in code examples without an explanation.

In some cases it is not but I always use it.

In code behind a form "Me" is a generic reference to the form. In code
behind a report it is a generic reference to the report. It is handy
because the code doesn't break if I change the name of the form or report or
if I copy it into another form or report. Neither of those would be true if
instead I used...

Forms!FormName!ComboBox.Requery
 
G

Garret

Ah I see the logic. This indeed has many advantages. The only
disadvantage I see is that after reading lines and lines of code,
seeing "Me" instead of Forms!FormName!ComboBox means you might get
lost. On the other hand, it makes things more legible. So whatever
floats your boat.
 
Top