469,293 Members | 1,335 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,293 developers. It's quick & easy.

You can't assign a value to this object - 2448

Morning all,

Not a clue why the hell this doesn't work so any help is most appreciated!!

Using one form I allow the user to filter the records using combo boxes. Works fine, all the filtered records appear in a column. Next to the filtered records I have 3 command buttons – Print Preview, Print Report & Modify Report. Print Preview and Print work fine, the trouble comes with the modify command button.

The code I use is:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Modify_Click()
  2.  
  3.    Dim criteria As String
  4.  
  5.    If Me.NewRecord Then
  6.        MsgBox "Please select a record to view."
  7.    Else
  8.        Criteria = "[ID] = " & Me.[ID]
  9.        DoCmd.OpenForm "Modify Main", , , criteria
  10.    End If
  11.  
  12. End Sub
The form opens up fine, pointing at the correct record but if I try and modify any information in it I get the error “You can't assign a value to this object”.

What is causing me confusion is that if I open form “Modify Main” from “Objects -> Forms” it opens to the 1st record (as you would expect) but it works fine, allowing all information to be edited.

Any pointers are most welcome!

Cheers

Phil
Dec 12 '06 #1
4 14868
NeoPa
32,173 Expert Mod 16PB
Maybe the record you are editing is locked by being selected on your first form.
Dec 12 '06 #2
MMcCarthy
14,534 Expert Mod 8TB
As Adrian said your record may be locked by the first form. Try closing the first form after opening the second form. If necessary you can always open it again when the second form closes.

Mary

Morning all,

Not a clue why the hell this doesn't work so any help is most appreciated!!

Using one form I allow the user to filter the records using combo boxes. Works fine, all the filtered records appear in a column. Next to the filtered records I have 3 command buttons – Print Preview, Print Report & Modify Report. Print Preview and Print work fine, the trouble comes with the modify command button.

The code I use is:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Modify_Click()
  2.  
  3.    Dim criteria As String
  4.  
  5.    If Me.NewRecord Then
  6.        MsgBox "Please select a record to view."
  7.    Else
  8.        Criteria = "[ID] = " & Me.[ID]
  9.        DoCmd.OpenForm "Modify Main", , , criteria
  10.    End If
  11.  
  12. End Sub
The form opens up fine, pointing at the correct record but if I try and modify any information in it I get the error “You can't assign a value to this object”.

What is causing me confusion is that if I open form “Modify Main” from “Objects -> Forms” it opens to the 1st record (as you would expect) but it works fine, allowing all information to be edited.

Any pointers are most welcome!

Cheers

Phil
Dec 13 '06 #3
Cheers for the help guys :)

As was pointed out by Adrian the filtered form was locking the form.

Incase anyone else suffers from this school boy error like myself the simple solution in my case was (in design mode) go to Properties -> Form (this is the filtered form that is being edited).

Select the 'Data' Tab and you should find a field called 'Record Locks'. Change this to 'No Locks' and all is well.
Jan 2 '07 #4
MMcCarthy
14,534 Expert Mod 8TB
Cheers for the help guys :)

As was pointed out by Adrian the filtered form was locking the form.

Incase anyone else suffers from this school boy error like myself the simple solution in my case was (in design mode) go to Properties -> Form (this is the filtered form that is being edited).

Select the 'Data' Tab and you should find a field called 'Record Locks'. Change this to 'No Locks' and all is well.
Just one thing in a multi user environment this can be dangerous as two users trying the edit a record concurrently can cause corruption. Although this may not be a common occurance it does happen.

Mary
Jan 3 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Duy Nguyen | last post: by
reply views Thread by Tim::.. | last post: by
5 posts views Thread by Just Me | last post: by
1 post views Thread by No_Spam | last post: by
18 posts views Thread by joaotsetsemoita | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.