About Update command (1 Viewer)

Pioneer

Registered User.
Local time
Today, 12:28
Joined
Aug 5, 2008
Messages
19
i have question?
i want to open my from as read only, for that i have to set form property Allow edit = no,
now i made one update command button so i can edit those detail and save into database table.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 20:28
Joined
Jul 9, 2003
Messages
16,349
You could add a command button and execute the following VBA code:

Me.Allowedit = true (pseudo code, may not be quite right)
 

missinglinq

AWF VIP
Local time
Today, 15:28
Joined
Jun 20, 2003
Messages
6,423
Almost, Tony! You need an "S" on the end:

Me.AllowEdits = True
 

Pioneer

Registered User.
Local time
Today, 12:28
Joined
Aug 5, 2008
Messages
19
Anybody help me

i have one pledge form , i open this form as AllowEdits= false,
i have one command button Update, when i click that button , form should be allow to insert data for that , i did me.allowedits= true.
now Problem is when i update the data after that form should be back to in AllowEdits=false , how can i do this.

Anyboday helps me, how to solve this problem.
 

khawar

AWF VIP
Local time
Today, 23:28
Joined
Oct 28, 2006
Messages
870
forms!yourformname.allowedits=true

and

forms!yourformname.allowedits=false

to disallow edits
 

Pioneer

Registered User.
Local time
Today, 12:28
Joined
Aug 5, 2008
Messages
19
that i know but the thing is where i can write code for AllowEdit = false,
i did at the same place when i write code for AllowEdits= true..........

here is my code................................
-------------------------------------------------------------------------------------
Private Sub btnUpdate_Click()

On Error GoTo Err_btnUpdate_Click

If (Me.AllowEdits = False) Then
Me.AllowEdits = True
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Pledge Form Data Entry"
DoCmd.OpenForm stDocName




End If


Me.AllowEdits = False

Exit_btnUpdate_Click:

Exit Sub

Err_btnUpdate_Click:
MsgBox Err.Description
Resume Exit_btnUpdate_Click


End Sub


------------------------------------------------------------------------------------

what do u think what edit can i do in my code, bcz the code is overwrite due with the AllowEdits= false , so form doesnt open into edit property, it always stay with allowedit= false.
 

khawar

AWF VIP
Local time
Today, 23:28
Joined
Oct 28, 2006
Messages
870
Ok try this
Set the caption of btnUpdate to "Edit"

Paste the following code behind the button

Code:
If me.btnUpdate.caption="Edit" then
Me.AllowEdits = True
me.btnUpdate.caption="Save"

else
Me.AllowEdits = False
me.btnUpdate.caption="Edit"

End If
 

Pioneer

Registered User.
Local time
Today, 12:28
Joined
Aug 5, 2008
Messages
19
can nor resolve whole problem?

Khawar thanks for yur help.
Code is not worked properly.

it saved data , but once u moved next record back again it works , we cann ot edit those thing,

when person stay on the same record once he click on edit - save after that again from shows Edit but without click on edit , person can edit details which is not correct. for that what can i do?

I can Edit data after i click on save , form saved data but after that , i want form again in by default mode, alloeedit = false, so person again click on edit then person only allow to change those things,
 

Users who are viewing this thread

Top Bottom