Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Textbox help please 2

Status
Not open for further replies.

simpsondm

IS-IT--Management
Jan 14, 2003
21
US
I have a form that has a status notes field and what I'm having a problem with is this.

I want the users to see the information in the status notes field but not beable to edit it what I need is either another textbox or popup that would allow the users to add notes. and once they save then the notes they added will be added to the status notes field.

Is this possible? If so could someone please help with how to make this happen.

Thanks
 
what i did for this, is place a label over top of the text box with the information on it, and require the user to click on a button to edit the txt box. it doesn't really make it Impossible to get to, but if you change the tab order of the textbox to 1, and place #2 as the get focus for on current you won't ever tab to the textbox. (unless you tab through all the tabs)

Here's my example:

Private Sub Form_Current()
Label1556.Caption = Nz(Me.Status)
end sub

Private Sub Status_LostFocus()
Label1556.Caption = Nz(Me.Status)
'make lable and button visible
lockstatus.Visible = False
Label1556.Visible = True
Edit_status.Visible = True
'set focus to vid txtbx
Me.VID.SetFocus
End Sub

I also have a lockstatus button, and an edit status button. The user "locks" the textbox after editing it, and must press "edit" to edit the text box. Otherwise they have to tab through all the controls on the form.

So, the order how I was able to make it so a user couldn't edit a textbox that must be updated was thus:

1.Hide my textbox

2.put a lable over the textbox that displays what information the textbox has.

3.create a button to modify the textbox - makes textbox visible, label invisible, edit button invisible.
4.make it so when the textbox loses focus, the edit button is visible, textbox is invisible, lock button (opposite of edit) is visible.

There might be an easier way, such as make a label's information dependant on a field not on the form, and have a popup form for additions. This is probably a better answer for your question, since in my situation, the textbox is editable once the user clicks on the edit.

With this in mind you'd have to:

1: put a label on your form that get's it's information from a field in your table.

2: Make a form for updates

3: have a popup form with an unbound textbox add whatever information was added to your status field

4: Have the label reupdated from the field


Hope this helps! Cruz'n and Booz'n always.
This post shows what little I do at work.
 
Hi - this is a very rough and ready means of passing data between forms - a more polished example would use custom form properties, but there's not room to go into that here...

1. On your main form ("Form_A") give your status notes textbox (txtStatusNotes) the following properties:

enabled = false
locked = true

2. Create a new form ("Form_B") for users to add comments via. All it needs is a textbox ("txtNewText") and OK and Cancel buttons.

Put the following code behind cmdOK and cmdCancel:

private sub cmdOK_Click()

me.visible = false

end sub

private sub cmdCancel_Click()

me.txtNewText = "++Cancelled++"
me.visible = false

end sub

3. Put an "Add Comment" command button near txtStatusNotes on Form_A. Put the following code behind it.

private sub cmdAddComment_Click()

DoCmd.OpenForm "Form_B", , , , , acDialog

If forms!Form_B!txtNewText <> &quot;++Cancelled++&quot; Then
me.txtStatusNotes = me.txtStatusNotes & vbCrLf & forms!Form_B!txtNewText
End If

docmd.close acform, &quot;Form_B&quot;

end sub

Like I say, this is very rough and ready and not very elegant. It should do the trick though.
 
you could probably use just an INPUT box for adding comments if you want.

have a button to click that updates your status, have the status box non visible, have a visible label that pulls the the information from that.

eg.

label1.caption = me.status
mystring = inputbox(prompt:=&quot;enter comments&quot;)
mystatus = nz(mystatus) & vbcrlf & mystring
me.refresh
label1.caption = me.status


that's the easiest way without making a form, without having your users have the ability to edit jack.
Cruz'n and Booz'n always.
This post shows what little I do at work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top