473,395 Members | 1,742 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,395 software developers and data experts.

Problem with Editing data and ControlSource

40
Hello,
Description:
1. I have a columnar form
2. There are 2 fields on this form: ID and NAME
3. Both fields have ControlSource ID_EMP and NAME_EMP
4. Both fields have enabled = false
5. I also have 2 buttons EDIT and ACCEPT

Problem:
I would like to edit NAME_EMP in selected record. After I click Edit I set all fields enabled = true. Now I want to edit NAME_EMP but save record only after I click ACCEPT. Now the record saves itself right after entering new value. How can I do that?

Cheers
Jul 13 '07 #1
9 1596
missinglinq
3,532 Expert 2GB
Not sure exactly what you mean by
saddist
Now the record saves itself right after entering new value
By default Access saves a record when you move to another record or close a form, provided required fields have been filled and all data validation is correct . Is this the behavior you're referring to in your statement, or is it truly saving the record after simply editing the name?

Linq ;0)>
Jul 13 '07 #2
saddist
40
when I enter new value in NAME textfield, and then change focus, the record changes. I want it to change only after I click ACCEPT button

Cheers

Not sure exactly what you mean by
By default Access saves a record when you move to another record or close a form, provided required fields have been filled and all data validation is correct . Is this the behavior you're referring to in your statement, or is it truly saving the record after simply editing the name?

Linq ;0)>
Jul 13 '07 #3
MikeTheBike
639 Expert 512MB
Hi

when I enter new value in NAME textfield, and then change focus, the record changes.
If the NAME textbox is the last control in the Tab Order, then when youn tab out of it it moves to the next record if the Cycle property is set to 'All Records' (which is the default). Is that the case?

If so, then change the property (Form -> Properties -> Other tab) to 'Current Record'

??


MTB
Jul 13 '07 #4
missinglinq
3,532 Expert 2GB
From what you said in #3 Mike's suggestion should solve the problem!

Linq ;0)>
Jul 13 '07 #5
saddist
40
it's not the case. I will try to show you the whole form:

Select emp: [combobox]
NAME: [textbox, ControlSource NAME_EMP]
CITY: [textbox, ControlSource: CITI_EMP]
SALARY: [textbox, ControlSource SALARY_EMP]
[buttonEdit]
[buttonAccept]
[buttonUndo]
[buttonCancel]

When I change something in NAME and then switch do CITI the record still updates. I want it to update only after I call buttonAccept_Click() method.

And now I have other problem. I made button called Undo. Here's the code:

Private Sub btnUndo_Click()
Dim ctlC As Control

For Each ctlC In Me.Controls
If ctlC.ControlType = acTextBox Then
ctlC.Value = ctlC.OldValue
End If
Next ctlC

End Sub

The problem is that it works fine for CITY textbox, but return error for NAME and SALARY. Error:
"Operation is not supported for this type of object"

Hi



If the NAME textbox is the last control in the Tab Order, then when youn tab out of it it moves to the next record if the Cycle property is set to 'All Records' (which is the default). Is that the case?

If so, then change the property (Form -> Properties -> Other tab) to 'Current Record'

??


MTB
Jul 13 '07 #6
MikeTheBike
639 Expert 512MB
Hi

For the undo I would try this
Expand|Select|Wrap|Line Numbers
  1. Private Sub btnUndo_Click()
  2.  
  3.       If Me.Dirty Then Me.Undo
  4.  
  5. End Sub
Other that my previous post, I cannot think of a reason why a record updates when you move from one control to the next. Perhaps there is some other code we do no know about!

The problem is that it works fine for CITY textbox, but return error for NAME and SALARY. Error:
"Operation is not supported for this type of object"
I'm not sure what works fine with the CITY textbox or what operation is not supported!?


MTB
Jul 13 '07 #7
saddist
40
Hi

For the undo I would try this
Expand|Select|Wrap|Line Numbers
  1. Private Sub btnUndo_Click()
  2.  
  3.       If Me.Dirty Then Me.Undo
  4.  
  5. End Sub
MTB
Still doesn't work :/ same error occures

I'm not sure what works fine with the CITY textbox or what operation is not supported!?
MTB
The undo function you wrote works fine for CITY textbox, but returns error for others.
Jul 18 '07 #8
missinglinq
3,532 Expert 2GB
when I enter new value in NAME textfield, and then change focus, the record changes. I want it to change only after I click ACCEPT button
Question: How do you know the record changes after moving focus to another control within the same record? What are you basing this observation/statement on?

The same question vis a vis the undo code throwing errors for NAME and SALARY. How are you determining that these two controls are throwing errors with this code?

Linq ;0)>
Jul 18 '07 #9
MikeTheBike
639 Expert 512MB
Hi

I'm with missinglinq.
We are missing something here (well obviously!)

Could you post all the code for the sub that throw the error and indicate which line causes the problem?

It just might give us a clue.

MTB
Jul 18 '07 #10

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

Similar topics

3
by: Shelli Carol | last post by:
Good day, I have: 1) A table with numbered fields (1, 2, 3, etc.) 2) A form text box, whose ControlSource property contains an expression. This expression returns a number. If I just...
0
by: Rick Brown | last post by:
Using Access97 I saved a form using "Save as Report". A column of textboxes show they are un-bound in design view, yet, when I preview the report these textboxes contain data even when there is no...
2
by: NewBob | last post by:
Since Access automatically highlights all of the text in a text control (I use it to hold data from a memo field) when the control is activated, I've added the following code to put the cursor at...
4
by: Bill Dika | last post by:
Hi I am trying to calculate a running total of a calculated textbox (tbAtStandard) in GroupFooter1 for placement in a textbox (tbTotalAtStandard) on my report in Groupfooter0. The problem...
0
by: TheCoder | last post by:
I am making a D-base with web conectivity for my class project. I have everything working but the subit button sends the data to the correct fields but afterwards it wants to reproduce new blank...
8
by: sara | last post by:
I have a report that runs fine with data. If there is no data, I have its NO Data event sending a MsgBox and cancelling the report. Then it seems I still get the 2501 message on the Open Report...
4
by: helenwheelss | last post by:
Access 2003, using a bound form. I'm seeing rather annoying behaviour when editing data in a control with a default value. It only happens when the form is on a new record. A specific...
10
by: RLN | last post by:
I have 4 queries and all 4 queries use different tables and pull different columns. Is it possible to have one Generic all Purpose form (frmGeneral) and on the fly at run time set frmGeneral's...
0
by: =?Utf-8?B?Q2hyaXN0aWFuIEJhaG5zZW4=?= | last post by:
Is it possible to bind a data access page textbox controlsource property at run time? I've tried using the BeforeInitialBind event to set the controlsource for textboxes, using syntax like ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.