Combo's

P

Peter

I have created a lot of combo's based on my tables. Is this the correct way
to do it, or should I base them on a query that is based on a table.

All the combo's are set to be invisible except for the first one. Depending
on what is chosen, I wish to make others appear. Is it just a case of
setting the visible flag to true when this item is chosen from the
afterupdate of the combos'

To have all the combo's invisible at the start of a new record, I use the
OnCurrent event, and set all the visible flags to false, but when I return
to a previous record, this makes my previously used combo's invisible as
well. How do I keep all the combo's used visible, but those that are not
used need to remain invisible.

hope you can help (and understand what I'm on about)

Peter
 
P

PC Datasheet

Peter said:
I have created a lot of combo's based on my tables. Is this the correct way
to do it, or should I base them on a query that is based on a table.

All the combo's are set to be invisible except for the first one. Depending
on what is chosen, I wish to make others appear. Is it just a case of
setting the visible flag to true when this item is chosen from the
afterupdate of the combos'

To have all the combo's invisible at the start of a new record, I use the
OnCurrent event, and set all the visible flags to false, but when I return
to a previous record, this makes my previously used combo's invisible as
well. How do I keep all the combo's used visible, but those that are not
used need to remain invisible.

hope you can help (and understand what I'm on about)

Peter
 
P

PC Datasheet

Add the following to your OnCurrent code:

If Me.NewRecord Then

<Your code>

End If
 
P

Peter

Thanks, that starts me off with one combo visible if I create a new record,
all the others are hidden Great.. If I create a new record, select from my
hidden combo's a number of choices which will make more combo's visible, how
do I keep only those combo's visible that I have selected data from that are
relevant to that record. These may be different for each record when I
scroll through the records.

I hope you can understand what I'm tring to say.

thanks

Peter
 
G

Graham R Seach

Peter,

You need a procedure like this, which you'd call from the form's Current
event:

Private Sub SetComboStatus()
Me.Combo1.Visible = (x = y)
Me.Combo2.Visible = (Me.Combo1 = 123)
Me.Combo3.Visible = (Me.Combo2.Visible = True And Me.Combo2 = "xyz")
' and so on...
End Sub

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
P

Peter

Hi Graham,

Can you elaborate a bit further, I'm just trying to teach myself VBA.

in your first line, what does the =(x=y) mean?

the first combo I have is called "LossType"

If I choose option 2 or 3 from this, I set the Visible flag to True on the
"ProcessStep" Combo

This in turn can then open 1 of 12 Combo's

Do you think there is an easier way to do this, all I want to do is have all
the options available from Combo's so no one has to type anything.

Peter
 
P

Peter

An Example1st Combo is named "LossType"

from here I can make 7 selections

If I choose option 2 "BreakDown" this in turn makes the following visible

Combo2 "ProcessStep" from here I choose "Paper"
Combo3 "Paper" (there are another 11 combo's stacked under here)

Combo4 "BreakDownCause" say I choose "Electrical"
Combo5 "Electrical" ( 4 combo's stacked here, Electrical, Mechanical,
Pneumatic & Hydraulic)

Combo6 "ProcessLoss"

Combo7 "Action"

When I move off this record and return, I would like to see the above
combo's only. Can you adapt your code to do this , then I can follow on from
that. Perhaps, you can think of an easier way of doing this.

Peter
 
P

Peter

Graham,

I want to start again with my Database from scratch. Would you be willing to
help me set up the various tables/queries relationships etc..I need.

Previously I have lumped everything into 1 table, and when trying to create
various reports its not working as I thought it would.

Peter
A very grateful Brit
 
G

Graham R Seach

Peter,

Sorry for not getting back to you sooner, but I've been ill.

<<in your first line, what does the =(x=y) mean?>>
When you "wrap" and expression in brackets, it is evaluated as a logical
expression, meaning, "is this expression true or false?" So where we have
(x=y), we are asking "does x equal y? If so, the answer is a Boolean True,
and if not, a False. Therefore, we applied to the combo's Visible property,
we're saying make the combo visible if the expression is True, otherwise
make it invisible.

Since you've decided to start from scratch, just post whatever questions you
need to ask. If it's not me who helps, it will be someone else. That's what
this newsgroup is for.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
P

Peter

Thanks Graham, I hope you are feeling better now.

What I am trying to do is create a Database of Machine downtime.

Depending on the type of stoppage, we have 10 steps to go through.

Step1 Basics
Date
Stop Time
Start Time
Crew
Product (combo if poss showing all products)

Choosing one of the option below requires one of the following steps. This
is the main reason for a stop. E.g If Choose Breakdown, I would like to
choose from prefilled combo's the steps required. Bot only make those
combo's appear that are required. The when I revisit the record, only those
used must show.

Step 2 LossType
Planned Maintenance (req. steps 1,2,3,4,10)
Breakdown (req. steps 1,2,3,4,5,6,9,10)
Process Loss (req. steps 1,2,3,4,5,7,9,10)
Start Up (Req. steps 1,2,3,4,10)
Other Downtime (req. steps 1,2,3,4,8,10)
Changeover (req. steps 1,2,3,4,10)
Machine Rework (req. steps 1,2,3,4,10)

Step 3 Scrap
Paper Scrap
Wet Scrap
Dry Scrap

Step 4 Energy
Burners Low fire
Burners Off
Fans Off

Step 5 Process Step
Paper: Reelstand 1, Reelstand 2 etc.. etc..
Dry Additives: Primary System, Stucco to Mixer etc.. etc..
etc... etc..

Step 6 Breakdown Cause
Electrical: PLC, Overload,Fuse etc.. etc..
Mechanical
etc.. etc..

Step 7 Process Loss
Paper Break (Lump)
Paper Break (Otehr)
etc... etc...

Step 8 Other Downtime
Paper
Stucco
etc.. etc..

Step 9 Action
Repair in situ
Repalce
etc.. etc..

Step 10 Comments
(a text box for comments)

What I have at the moment is everything lumped into 1 table. I have a main
form with loads of combo's giving the required choices. Some of these are
stacked on top of each other, becoming visibe when a related option is
chosen from one of the others.

The reason I chose Combo's was to make sure all the people using the
Database was to stop random entries plus it means less typing.

I did get this working, but struggled to make the correct combo's appear,
then when I returned to a previous record I couldn't make it remember what I
had chosen.

Plus by having it all in one table, my reports were no good, as they just
returned numbers instead of meaningful text entries.

I hope you get my drift.

Thanks

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top