Show Text box

  • Thread starter Thread starter Jessie
  • Start date Start date
J

Jessie

hello,

I have users log into a db using a form. Once they log in
another form opens for them to enter sales. The sales
order form pulls the Rep Id and Sales Campaign Name from
the login Table (tblCSRInfo).

If they are logged into Campaign XYZ I need to show an
additional entry field that other campaigns do not use.

I am not sure how to or where to add the statement.

Thanks,
Jessie
 
When your form knows which campaign the person is in, you can run code that
changes the visibility of that textbox:

Me.txtBoxName.Visible = True

or

Me.txtBoxName.Visible = False

Where you'd put this code depends entirely on when you need to run it....and
I can't tell that from what you've posted.
 
I have been bouncing around Ideas as to where to have it
run.

Right now the way the Campaign is displayed for the Sales
Rep is in a locked Text box. When they login they click a
cmd button that minimizes the login form and opens the
sales form. The sales form has a Campaign text box whose
default value is the campaign the sales rep chose when
they logged in. I have to have a seperate login/ out table
so I can later calculate the hours spent on each campaign.

I originally was thinking to have the code look at that
field on open, but since it is a default value, would the
value of that field actually be XYZ yet, or does that
record need to be updated first. So then I was thinking I
would have a "Sale" Check Box that after update could
lookup the value of the Campaign text box and if that =XYZ
then show my new text box that will allow the user to
input units sold.

What I am having the worst trouble with is getting an if
statement to work. Here is what I have:

Dim cnt As Control
Set cnt = Forms.frmSalesSht.Campaign
If cnt = XYZ Then
Me!txtUntSld.Visible = True
Else
Me!txtUntSld.Visible = False

End If

I know it is probably terrible!Any help would be greatly
appreciated.

Jessie
 
I would use the form's OnLoad event to look at the campaign text box and to
set the visible property of the other textbox.

I would use code similar to this:

Private Sub Form_Load()
Me.txtUntSld.Visible = (Me.Campaign.Value = "XYZ")
End Sub
 
-----Original Message-----
hello,

I have users log into a db using a form. Once they log in
another form opens for them to enter sales. The sales
order form pulls the Rep Id and Sales Campaign Name from
the login Table (tblCSRInfo).

If they are logged into Campaign XYZ I need to show an
additional entry field that other campaigns do not use.

I am not sure how to or where to add the statement.

Thanks,
Jessie
.
Hi Jessie, consider using the form_onload() event. use the
following as an example...

private sub form_onload()
if lcase(txtSalesCampaign) = "xyz" then
txtSpecialEvent.visible=true
end if
end sub

have the txtSpecialEvent (or whatever name that you have
given this control) set to visible=false in your form
design.

Luck
Jonathan
 
Back
Top