UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Edit Not Working, Access 2010    
 
   
swarm6
post Aug 11 2017, 10:20 AM
Post#1



Posts: 69
Joined: 9-May 12



I have a continuous form that I open as read only. Then I have a button that opens the same form in Edit Mode with only the record to be edited showing. All text boxes are enabled and unlocked; additions, edits, etc are all allowed. Data Entry Mode is no. The query is simple and editable.

Any clue as to why I cannot Edit as though the record is locked?

Thank you.
Go to the top of the page
 
DanielPineault
post Aug 11 2017, 10:32 AM
Post#2


UtterAccess VIP
Posts: 5,075
Joined: 30-June 11



We'd need to see your code.

--------------------
Daniel Pineault (2010-2017 Microsoft MVP)
Professional Help: http://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: http://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc


All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...
Go to the top of the page
 
swarm6
post Aug 11 2017, 11:09 AM
Post#3



Posts: 69
Joined: 9-May 12



Thank you. It's a simple Macro (open in Edit Mode and filter for this Client). I have converted it to VB so you can see it. Would a screen shot of the Macro be better?




' btnEdit_Click
'
'------------------------------------------------------------
Private Sub btnEdit_Click()
On Error GoTo btnEdit_Click_Err

DoCmd.OpenForm "frmClientList", acNormal, "", "[ClientID]=" & ClientID, acEdit, acNormal


btnEdit_Click_Exit:
Exit Sub

btnEdit_Click_Err:
MsgBox Error$
Resume btnEdit_Click_Exit
Go to the top of the page
 
Jeff B.
post Aug 11 2017, 12:40 PM
Post#4


UtterAccess VIP
Posts: 9,779
Joined: 30-April 10
From: Pacific NorthWet


What is the data type of [ClientID]?

(... and although I suspect the answer, is the form bound or unbound?)

--------------------
Regards

Jeff Boyce
Microsoft Access MVP (2002-2015)

Mention of hardware or software is, in no way, an endorsement thereof. The FTC of the USA made this disclaimer necessary/possible.
Go to the top of the page
 
swarm6
post Aug 11 2017, 01:47 PM
Post#5



Posts: 69
Joined: 9-May 12



ClientID is an autonumber in the client table, and the form is bound to the client table.
Go to the top of the page
 
swarm6
post Aug 11 2017, 02:20 PM
Post#6



Posts: 69
Joined: 9-May 12



I have determined that the Edit Mode will work if you close the form and then open it in Edit Mode, but I didn't want to lose the reference to the specific record I wanted to edit. As a work around, I have created another form that will hold the clientID number of the specific record to edit.

Go to the top of the page
 
tina t
post Aug 11 2017, 02:30 PM
Post#7



Posts: 5,110
Joined: 11-November 10
From: SoCal, USA


QUOTE
I have a continuous form that I open as read only. Then I have a button that opens the same form in Edit Mode

i guess my question is: why try to open a second instance of the same form? why not just filter the open form to the record you want, and then change the mode of the form?

hth
tina

--------------------
"you can't take the sky from me"
Go to the top of the page
 
missinglinq
post Aug 11 2017, 04:51 PM
Post#8



Posts: 4,351
Joined: 11-November 02



Your posted code has two incorrect arguments:

DoCmd.OpenForm "frmClientList", acNormal, "", "[ClientID]=" & ClientID, acEdit, acNormal

should be

DoCmd.OpenForm "frmClientList", acNormal, "", "[ClientID]=" & ClientID, acFormEdit, acWindowNormal

Linq ;0)>

--------------------
Hope this helps!

The problem with making anything foolproof...is that fools are so darn ingenious!

All posts/responses based on Access 2003/2007
Go to the top of the page
 
GroverParkGeorge
post Aug 12 2017, 07:16 AM
Post#9


UA Admin
Posts: 30,177
Joined: 20-June 02
From: Newcastle, WA


PMFJI:

Quite some time ago, I became convinced that using fully qualified arguments is a better strategy here for two reasons.

One, you get intellisense that way, which means errors like those linq spotted, are less likely.

Two, because named arguments don't depend on position, you can avoid the hassles of counting commas within the argument string. I leave the sequence as it normally appears, but you can even rearrange arguments, as well as omit empty arguments:

Attached File  FullyQualifiedArguments.png ( 14.3K )Number of downloads: 5



--------------------
Go to the top of the page
 
swarm6
post Aug 12 2017, 07:55 AM
Post#10



Posts: 69
Joined: 9-May 12



Thank you, Tina. In essence, that was what I was trying to do. How do you change the mode of the form to "Edit"?

Thank you!
Go to the top of the page
 
swarm6
post Aug 12 2017, 07:56 AM
Post#11



Posts: 69
Joined: 9-May 12



Thank you, Linq.
Go to the top of the page
 
swarm6
post Aug 12 2017, 07:59 AM
Post#12



Posts: 69
Joined: 9-May 12



Thank you, George. Major problem here: I don't know VB. I use macros, and when I have to, I convert them to VB and tweak them.

Thank you.
Go to the top of the page
 
GroverParkGeorge
post Aug 12 2017, 08:14 AM
Post#13


UA Admin
Posts: 30,177
Joined: 20-June 02
From: Newcastle, WA


Well, as you have probably heard, VBA is more powerful, flexible, and extensible than macros. If you plan on taking MS Access beyond the basic level, it's well worth learning. In any event, I think you've sorted out this problem, right?

--------------------
Go to the top of the page
 
tina t
post Aug 13 2017, 12:20 AM
Post#14



Posts: 5,110
Joined: 11-November 10
From: SoCal, USA


QUOTE
Thank you, Tina. In essence, that was what I was trying to do. How do you change the mode of the form to "Edit"?

well, harking back to your initial post:

QUOTE
I have a continuous form that I open as read only.

from that, i assume that you're using a macro to open the form "the first time", with a DataMode setting of Read Only. if my assumption is correct, then i'd suggest doing the following instead:

open the form in Design view, and change the RecordsetType property setting to Snapshot. save and close.
use the command button on the form to filter to the single record you want to edit. i recommend doing this in VBA, in the button's Click event procedure.
in the same procedure, change the RecordsetType property to Dynaset, as

Me.RecordsetType = 0

you can use another button to remove the form filter, and in that button's procedure also set the property back to Snapshot, as

Me.RecordsetType = 2

if you want to know where i got the numeric values for the settings, open the VBA module that's part of the form, click anywhere in the word RecordsetType, and press F1. in older versions of Access, that will take you directly to the relevant Help topic - hopefully it works the same in newer versions of Access as well.

and, btw, since you're comfortable with macros, doing what you can in a macro (you can't do everything there that VBA can do), and then converting it to VBA, is a good way to begin to learn. i did that a lot when i was first learning VBA. and the F1 trick - you can learn a whole lot from Access Help; that's still my first recourse when i'm trying to figure out how to do something.

hth
tina

--------------------
"you can't take the sky from me"
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    18th August 2017 - 10:35 PM