473,407 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

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 15165
NeoPa
32,556 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

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

Similar topics

2
by: Duy Nguyen | last post by:
how can I save an image file to database?
0
by: Tim::.. | last post by:
HELP... Can someone please tell me why I keep getting the following error! I am new to AD is ASP.NET and would really appritiate any advice! Thanks ...ERROR.. Exception Details:...
5
by: Just Me | last post by:
Given a button name Btn_5 and Index=5 I want to do something like dim zz as string = Btn_??Index??.Text or given an array of buttons, do:
12
by: dennist685 | last post by:
Can't edit, delete or add row in an Access database in a website 2003 When I implement a walkthrough using Northwind I have no trouble doing this. Also, in a windowsforms project I have no...
12
by: Danny Colligan | last post by:
In the following code snippet, I attempt to assign 10 to every index in the list a and fail because when I try to assign number to 10, number is a deep copy of the ith index (is this statement...
1
by: No_Spam | last post by:
I have an MS Access form attached to a table. I have a text box which has its control source set to a field in the table... However, at run time if certain things change, I want to the change the...
18
by: joaotsetsemoita | last post by:
Hello everyone, I'm having troubles assigning an onclick event to a cell. Im trying something like cursorPoint.cells.style.cursor = "hand"; cursorPoint.cells.width = "20";...
28
by: Stef Mientki | last post by:
hello, I'm trying to build a simple functional simulator for JAL (a Pascal-like language for PICs). My first action is to translate the JAL code into Python code. The reason for this approach is...
8
Dököll
by: Dököll | last post by:
Hey gang! Below code allows me to search my database though all fields included on the form. Works great. Small issue, when I fetch partial phrases, if they contain an apostrophy, say, "Ferris...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.