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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a "modify" button on a form

Status
Not open for further replies.

Marthaot

Technical User
Mar 26, 2002
9
IE
Do you have to write code to have a 'modify a record'on forms? I can't find any relevant choices in the wizard, and I don't know what code to write.
 
A very inelaborate, quick 'n' dirty code solution would be to set a filter (for your single record) and then go to database view. Beyond that there are dozens of ways to go, depending on your coding level and amount of time you have to put into it.

But sorry, as to wizard code for this, no, I'm not aware of such. [sad]
 
If you are trying to Lock the records and then have the ability to unlock them manually with a toggle button, try creating a button and setting its OnClick property to this routine:


Private Sub btnLock_Click()
SetTextBoxProperties Me
End Sub


Sub SetTextBoxProperties(frm As Form)
Dim ctl As Control

' Enumerate Controls collection.
For Each ctl In frm.Controls
' Check to see if control is locked.
If ctl.ControlType = acTextBox Then
If ctl.Locked = -1 Then
' unlock it
ctl.Locked = 0
Me.btnLock.Caption = "Lock"
Me.btnLock.ForeColor = 128
Else
ctl.Locked = -1
Me.btnLock.Caption = "Unlock"
Me.btnLock.ForeColor = 10485760
End If
End If
Next ctl
End Sub

joshuab@musician.org
joshuaweb.htmlplanet.com
 
If Joshman is correct in his appraisal of what you are trying to do, then another simple yet quick and dirty approach would be to create two forms one editable, on non-editable.

The default (non-editable) one would have a button on which opens the editable version at the same record and closes down the non-editable one.

V simple to achieve with no knowledge of VB.

Hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top