By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,997 Members | 1,270 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,997 IT Pros & Developers. It's quick & easy.

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

P: 31
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
Share this Question
Share on Google+
4 Replies


NeoPa
Expert Mod 15k+
P: 31,429
Maybe the record you are editing is locked by being selected on your first form.
Dec 12 '06 #2

MMcCarthy
Expert Mod 10K+
P: 14,534
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

P: 31
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
Expert Mod 10K+
P: 14,534
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.