How to use txtboxes and Combo boxes in a form

  • Thread starter Thread starter sebastico
  • Start date Start date
S

sebastico

Hello Foro
Access 3003.
In a form I'm trying to design a search where user only enter data in three
textboxes.
In a query I have the following parameter :

Like [Forms].[Form].[txtName] & "*"
Like [Forms]![Form].[txtCity] & "*"
Like [Forms].[Form].[txtStreet] & "*"

The fields: OO1, YY1, RR1 do not have parameters but they displays records
in the query as I mentioned here.

The query displays records in the fields
AZ1, AZ2, AZ3, AZ4, AZ5 and AZ6

In the form, I would like to add two combo boxes but with this conditions.
If user select a row from Combo box1 the Combo box 2 must be disabled and
the textboxes as well
If user select a row from Combo box2 the Combo box 1 must be disabled and
the textboxes as well.

Please could you suggest how can I do this?

Many thanks
 
If the user select a row from combo1, combo2 get disabled, ... but then, how
to 'undo', how to give the user the possibility to select something in
combo2 (and disable combo1) ?

If you don't disable the 'other' combo box, the criteria using

under matching field for combo1:
LIKE FORMS!formName!Combo1 & "*"


and under matching field for combo2:
LIKE FORMS!formName!Combo2 & "*"


you should still get the possibility to select data, or not, in the combo
boxes, and if there is no selected data, that combo box criteria would be as
if it was by bypassed.



Vanderghast, Access MVP
 
Vandergast


Sorry. I did not mention that I have a button to clean all controls in the
form, so after using combo box1 user can clean the controls and then use
combo box2

Already I have two querys one for combo box1 and one for combo box2.
I think that one solution is to add another button to display the query for
combo box1, then user may clean records in controls and can use Combo box1 or
Combo box2
I don't know the code for such application, could you suggest me how to do it?

Many thanks for your help



vanderghast said:
If the user select a row from combo1, combo2 get disabled, ... but then, how
to 'undo', how to give the user the possibility to select something in
combo2 (and disable combo1) ?

If you don't disable the 'other' combo box, the criteria using

under matching field for combo1:
LIKE FORMS!formName!Combo1 & "*"


and under matching field for combo2:
LIKE FORMS!formName!Combo2 & "*"


you should still get the possibility to select data, or not, in the combo
boxes, and if there is no selected data, that combo box criteria would be as
if it was by bypassed.



Vanderghast, Access MVP


sebastico said:
Hello Foro
Access 3003.
In a form I'm trying to design a search where user only enter data in
three
textboxes.
In a query I have the following parameter :

Like [Forms].[Form].[txtName] & "*"
Like [Forms]![Form].[txtCity] & "*"
Like [Forms].[Form].[txtStreet] & "*"

The fields: OO1, YY1, RR1 do not have parameters but they displays records
in the query as I mentioned here.

The query displays records in the fields
AZ1, AZ2, AZ3, AZ4, AZ5 and AZ6

In the form, I would like to add two combo boxes but with this conditions.
If user select a row from Combo box1 the Combo box 2 must be disabled and
the textboxes as well
If user select a row from Combo box2 the Combo box 1 must be disabled and
the textboxes as well.

Please could you suggest how can I do this?

Many thanks
 
In the after update event handling procedure for each combo box, you can
disable the other combo box, and set its value to null.

------with Combo8 and Combo10 , here the code for Combo8 ---------
Private Sub Combo8_AfterUpdate()

If Me.Combo8.Value = Null Then Exit Sub

Me.Combo10.Enabled = False
Me.Combo10.Value = Null

End Sub
---------------------------------------------------------------------------


and you add a similar one for the other combo box, in the after update event
(of the combo box, NOT of the form).



Vanderghast, Access MVP

sebastico said:
Vandergast


Sorry. I did not mention that I have a button to clean all controls in the
form, so after using combo box1 user can clean the controls and then use
combo box2

Already I have two querys one for combo box1 and one for combo box2.
I think that one solution is to add another button to display the query
for
combo box1, then user may clean records in controls and can use Combo box1
or
Combo box2
I don't know the code for such application, could you suggest me how to do
it?

Many thanks for your help



vanderghast said:
If the user select a row from combo1, combo2 get disabled, ... but then,
how
to 'undo', how to give the user the possibility to select something in
combo2 (and disable combo1) ?

If you don't disable the 'other' combo box, the criteria using

under matching field for combo1:
LIKE FORMS!formName!Combo1 & "*"


and under matching field for combo2:
LIKE FORMS!formName!Combo2 & "*"


you should still get the possibility to select data, or not, in the combo
boxes, and if there is no selected data, that combo box criteria would be
as
if it was by bypassed.



Vanderghast, Access MVP


sebastico said:
Hello Foro
Access 3003.
In a form I'm trying to design a search where user only enter data in
three
textboxes.
In a query I have the following parameter :

Like [Forms].[Form].[txtName] & "*"
Like [Forms]![Form].[txtCity] & "*"
Like [Forms].[Form].[txtStreet] & "*"

The fields: OO1, YY1, RR1 do not have parameters but they displays
records
in the query as I mentioned here.

The query displays records in the fields
AZ1, AZ2, AZ3, AZ4, AZ5 and AZ6

In the form, I would like to add two combo boxes but with this
conditions.
If user select a row from Combo box1 the Combo box 2 must be disabled
and
the textboxes as well
If user select a row from Combo box2 the Combo box 1 must be disabled
and
the textboxes as well.

Please could you suggest how can I do this?

Many thanks
 
Back
Top