Form related three questions

  • Thread starter =?ISO-8859-9?Q?Veli_=DDzzet?=
  • Start date
?

=?ISO-8859-9?Q?Veli_=DDzzet?=

Hi,

I have three questions to ask

1-I have two combo boxes on one form.
They are limited to the list.
I want the second one to be left out of the tab order if a certain item
is entered in the

first box (by selecting from a list).

2- I have few derived data on the form. They are not in the tab order.
How do I limit the

mouse to go over to these textboxes. I want to be sure they will not be
edited.

3- I have an image that is controlled by the procedure:
---
Private Sub Form_Current()
On Error Resume Next
Me![ImagePic].Picture = Application.CurrentProject.Path & "\slides\" &
Me![KOD] & ".jpg"
End Sub
---

When there is no picture of the item (either does not exist, or [KOD] is
empty), the

picture that was on the form stays.

I want this picture on the form to disappear if the item does not have a
picture.

Thanks for answers,
 
S

Steve Schapel

Veli,
1-I have two combo boxes on one form.
They are limited to the list.
I want the second one to be left out of the tab order if a certain item
is entered in the
first box (by selecting from a list).

Try code something like this, on the After Update event of the first
combobox...
Me.SecondCombobox.TabStop = Me.FirstCombobox <> "a certain item"
or...
Me.TheNextControl.SetFocus
2- I have few derived data on the form. They are not in the tab order.
How do I limit the
mouse to go over to these textboxes. I want to be sure they will not be
edited.

Set the Enables property of these controls to No, and their Locked
property to Yes.
3- I have an image that is controlled by the procedure:
---
Private Sub Form_Current()
On Error Resume Next
Me![ImagePic].Picture = Application.CurrentProject.Path & "\slides\" &
Me![KOD] & ".jpg"
End Sub
---

When there is no picture of the item (either does not exist, or [KOD] is
empty), the
picture that was on the form stays.
I want this picture on the form to disappear if the item does not have a
picture.

Hmmm. Try something like this...
If Len(Dir(CurrentProject.Path & "\slides\" & Me![KOD] & ".jpg")) Then
Me![ImagePic].Picture = CurrentProject.Path & "\slides\" & Me![KOD]
& ".jpg"
Else
Me![ImagePic].Picture = ""
End If
 
V

VI

Steve,
Thans very much.
No 2 and 3 worked. I have a question about number 1 though.

If I had no code etc, the tab and mouse would go to the secondcombobox.
If Me.firstcombobox <> "item" would it not go to the second one as this
IF was not met?

Would I have to set the attribute of the second box to not accept any
input otherwise, or am I confused totally?

Regards,


Steve said:
Veli,
1-I have two combo boxes on one form.
They are limited to the list.
I want the second one to be left out of the tab order if a certain
item is entered in the
first box (by selecting from a list).


Try code something like this, on the After Update event of the first
combobox...
Me.SecondCombobox.TabStop = Me.FirstCombobox <> "a certain item"
or...
Me.TheNextControl.SetFocus
2- I have few derived data on the form. They are not in the tab order.
How do I limit the
mouse to go over to these textboxes. I want to be sure they will not
be edited.


Set the Enables property of these controls to No, and their Locked
property to Yes.
3- I have an image that is controlled by the procedure:
---
Private Sub Form_Current()
On Error Resume Next
Me![ImagePic].Picture = Application.CurrentProject.Path & "\slides\" &
Me![KOD] & ".jpg"
End Sub
---

When there is no picture of the item (either does not exist, or [KOD]
is empty), the
picture that was on the form stays.
I want this picture on the form to disappear if the item does not have
a picture.


Hmmm. Try something like this...
If Len(Dir(CurrentProject.Path & "\slides\" & Me![KOD] & ".jpg")) Then
Me![ImagePic].Picture = CurrentProject.Path & "\slides\" & Me![KOD]
& ".jpg"
Else
Me![ImagePic].Picture = ""
End If
 
D

Douglas J Steele

You said that you didn't want to tab into the second combobox if the first
combobox had a specific value in it.

Steve's code checks whether or not the first combobox has that specific
value. If that specific value was selected, Me.firstcombobox <> "item" will
be False, so you're setting the Tabstop property of the second combobox to
False, meaning you won't be able to tab into it. If the specific value
wasn't selected, Me.firstcombobox <> "item" will be True, so you will be
able to tab into the second combobox.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


VI said:
Steve,
Thans very much.
No 2 and 3 worked. I have a question about number 1 though.

If I had no code etc, the tab and mouse would go to the secondcombobox.
If Me.firstcombobox <> "item" would it not go to the second one as this
IF was not met?

Would I have to set the attribute of the second box to not accept any
input otherwise, or am I confused totally?

Regards,


Steve said:
Veli,
1-I have two combo boxes on one form.
They are limited to the list.
I want the second one to be left out of the tab order if a certain
item is entered in the
first box (by selecting from a list).


Try code something like this, on the After Update event of the first
combobox...
Me.SecondCombobox.TabStop = Me.FirstCombobox <> "a certain item"
or...
Me.TheNextControl.SetFocus
2- I have few derived data on the form. They are not in the tab order.
How do I limit the
mouse to go over to these textboxes. I want to be sure they will not
be edited.


Set the Enables property of these controls to No, and their Locked
property to Yes.
3- I have an image that is controlled by the procedure:
---
Private Sub Form_Current()
On Error Resume Next
Me![ImagePic].Picture = Application.CurrentProject.Path & "\slides\" &
Me![KOD] & ".jpg"
End Sub
---

When there is no picture of the item (either does not exist, or [KOD]
is empty), the
picture that was on the form stays.
I want this picture on the form to disappear if the item does not have
a picture.


Hmmm. Try something like this...
If Len(Dir(CurrentProject.Path & "\slides\" & Me![KOD] & ".jpg")) Then
Me![ImagePic].Picture = CurrentProject.Path & "\slides\" & Me![KOD]
& ".jpg"
Else
Me![ImagePic].Picture = ""
End If
 
V

VI

Hi,

I am now correcting myself about what I want.

There are two combo boxes box1 and box2. Box1 shows the state (ready for
sale, in consignment, on the shelf, sold, etc) of an item, and box2 is
controlled by wherabouts of the item (shop1, shop2, shop3, etc).

So in the form you choose eg. on the shelf and shop2.

When the state of the item turns to "Sold" with the aid of the dropdown
list of box1, I want the wherabouts field to stay as it was, and nobody
would be able to go to that field and change the value in it.


In English:

If value of box1 is "Sold" (changed to "Sold"),
then turn box2 into unenabled and locked
endif

How do Iwrite this in VB?

Thanks for the help
 
D

Douglas J Steele

With Me.SecondComboBox
.Enabled = (Me.FirstComboBox.Value & "" <> "Sold")
.Locked = Not (Me.FirstComboBox.Value & "" <> "Sold")
End With

Where you put this code depends on your form. At a minimum, you'll want it
in the AfterUpdate event of FirstComboBox. You may also way to call that
same code in the form's Current event.
 
G

Guest

1. Simply use an If statement to set the TabStop property of the second text
box.

2. I believe what you want would be set their properties to Enabled = No,
Locked = Yes. This keeps the text box looking active, but does not allow any
edits.

3. Could you add an IIF statement that either sets the Visible property to
No/False, or to display a 'default' image (company logo?) if no .jpg is
available.

Sharkbyte
 
G

Guest

Try this:

If Combo1 = "Sold" Then
Combo2.Enabled = False
Combo2.Locked = True
Else
End If

Sharkbyte
 
D

Douglas J. Steele

Unless you make that:

If Combo1 = "Sold" Then
Combo2.Enabled = False
Combo2.Locked = True
Else
Combo2.Enabled = True
Combo2.Locked = False
End If

the combo box won't ever unlock once it gets locked.
 

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

Similar Threads

Help needed with code 2
Pictures on forms 1
Pictures in report 6
Please check code 2
Textbox Problem 1
Access Form Refresh 1
Getting images from filesystem in forms and reports. 4
picture help 3

Top