472,808 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,808 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 15101
NeoPa
32,534 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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.