473,395 Members | 2,446 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.

Edit single record in continuous subform

Using Access 2000 on XP, I have a continuous subform that lists the different licenses attributed to a person selected (current record of the main form). This is what each line of the sub form looks like:
__________________________________________________ ________________

License Name:
[Combo Box]: Names

License Key:
[Text Box]: Key

License Active:
[Check Box]: Y/N

LicenseID:
[Text Box]: ID#

[Button]: "Edit Name & Key" (Hidden and replaced with "Save" when pressed)

[Button]: "Activate" (Hidden and replaced with "Deactivate" when pressed)
__________________________________________________ ________________

Since this is a continuous form, it will repeat the section above for as many Licenses that a given person has. LicenseID refers to the AutoNumber(pk) of a row in a table that maps each license name to each person.

License Name and License Key are retrieved from this table, and show the correct information for each person selected. I set them as locked, and I would like the Edit button to unlock them and enable the user to input new information to either box. When the information is changed in these boxes, it is correctly changed in the related table as well.

The problem I am having is that whenever the Edit button is pressed, it unlocks the License Name box and License Key box in EVERY sub form line listed, I want it to only unlock in the line that it is pressed. (Same for the Deactivate button).

I have spent several days trying to find a solution for this and have not found anything...I am currently trying a solution that uses the ID# listed in the line and sets the boxes to unlocked if the ID# value = value of an invisible unbound box with the copy of the ID#....which still produces the same results.

I have little experience with Access so I hope I've posted enough information, if anyone could help I'd appreciate it. Thanks.
Aug 10 '07 #1
8 7479
Rabbit
12,516 Expert Mod 8TB
Using Access 2000 on XP, I have a continuous subform that lists the different licenses attributed to a person selected (current record of the main form). This is what each line of the sub form looks like:
__________________________________________________ ________________

License Name:
[Combo Box]: Names

License Key:
[Text Box]: Key

License Active:
[Check Box]: Y/N

LicenseID:
[Text Box]: ID#

[Button]: "Edit Name & Key" (Hidden and replaced with "Save" when pressed)

[Button]: "Activate" (Hidden and replaced with "Deactivate" when pressed)
__________________________________________________ ________________

Since this is a continuous form, it will repeat the section above for as many Licenses that a given person has. LicenseID refers to the AutoNumber(pk) of a row in a table that maps each license name to each person.

License Name and License Key are retrieved from this table, and show the correct information for each person selected. I set them as locked, and I would like the Edit button to unlock them and enable the user to input new information to either box. When the information is changed in these boxes, it is correctly changed in the related table as well.

The problem I am having is that whenever the Edit button is pressed, it unlocks the License Name box and License Key box in EVERY sub form line listed, I want it to only unlock in the line that it is pressed. (Same for the Deactivate button).

I have spent several days trying to find a solution for this and have not found anything...I am currently trying a solution that uses the ID# listed in the line and sets the boxes to unlocked if the ID# value = value of an invisible unbound box with the copy of the ID#....which still produces the same results.

I have little experience with Access so I hope I've posted enough information, if anyone could help I'd appreciate it. Thanks.
You can't do this in a continuous subform. One control is linked to every other control.

You can, however, reset everything back to baseline in the On Current event of the form. This way, they can unlock the current record they're on, which unlocks every other control in every other record as well. But when they move it a new record, it relocks everything.
Aug 10 '07 #2
You can't do this in a continuous subform. One control is linked to every other control.

You can, however, reset everything back to baseline in the On Current event of the form. This way, they can unlock the current record they're on, which unlocks every other control in every other record as well. But when they move it a new record, it relocks everything.
Thank you for the quick response. It's great to finally get a solution to this instead of spending endless hours searching for one

Could you provide the code to perform this reset? Also, would my original proposal be possible in Single Form view?

Thanks again.
Aug 10 '07 #3
Rabbit
12,516 Expert Mod 8TB
Thank you for the quick response. It's great to finally get a solution to this instead of spending endless hours searching for one

Could you provide the code to perform this reset? Also, would my original proposal be possible in Single Form view?

Thanks again.
It's be the same situation with single form view.

I'm assuming the following.

Baseline Settings:
txtName = Locked
txtSomeField = Locked
butEdit

When they click butEdit:
Expand|Select|Wrap|Line Numbers
  1. Private Sub butEdit_Click()
  2.    Me.txtName.Locked = False
  3.    Me.txtSomeField.Locked = False
  4.    Me.butEdit.Caption = "Save"
  5. End Sub
  6.  
I assume that's where you are currently?

Put this in:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.    Me.txtName.Locked = True
  3.    Me.txtSomeField.Locked = True
  4.    Me.butEdit.Caption = "Edit"
  5. End Sub
  6.  
This won't prevent all the other controls from unlocking but it will relock them and put everything back to baseline if they move to a different record. The baseline, of course, is defined by you.
Aug 10 '07 #4
It's be the same situation with single form view.

I'm assuming the following.

Baseline Settings:
txtName = Locked
txtSomeField = Locked
butEdit

When they click butEdit:
Expand|Select|Wrap|Line Numbers
  1. Private Sub butEdit_Click()
  2.    Me.txtName.Locked = False
  3.    Me.txtSomeField.Locked = False
  4.    Me.butEdit.Caption = "Save"
  5. End Sub
  6.  
I assume that's where you are currently?

Put this in:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.    Me.txtName.Locked = True
  3.    Me.txtSomeField.Locked = True
  4.    Me.butEdit.Caption = "Edit"
  5. End Sub
  6.  
This won't prevent all the other controls from unlocking but it will relock them and put everything back to baseline if they move to a different record. The baseline, of course, is defined by you.
That's the basic idea, yes. However, the edit button and save button are two separate buttons, Save is not visible until Edit is pressed, and vice versa.

I tried this code but it still did not work, after hitting Edit I was able to edit the boxes in the same record, and when I moved to a different record nothing was reset as I was still able to edit the other records.

Any other ideas? I appreciate the help.
Aug 10 '07 #5
Rabbit
12,516 Expert Mod 8TB
That's the basic idea, yes. However, the edit button and save button are two separate buttons, Save is not visible until Edit is pressed, and vice versa.

I tried this code but it still did not work, after hitting Edit I was able to edit the boxes in the same record, and when I moved to a different record nothing was reset as I was still able to edit the other records.

Any other ideas? I appreciate the help.
Can you post the code you put in?
Aug 10 '07 #6
Can you post the code you put in?
Sorry about the delay, I am doing this on a work computer and did not have access to it all weekend.

Here is the code for my Edit button (I also change the back color to yellow for editing):

Private Sub Edit_Click()

Me.LicenseName.Locked = False
Me.LicenseName.BackColor = 65535
Me.LicenseKey.Locked = False
Me.LicenseKey.BackColor = 65535

Save.Visible = True
Save.SetFocus
Edit.Visible = False

End Sub

Code for my save button:

Private Sub Save_Click()

Me.LicenseName.Locked = True
Me.LicenseName.BackColor = -2147483643
Me.LicenseKey.Locked = True
Me.LicenseKey.BackColor = -2147483643

Edit.Visible = True
Edit.SetFocus
Save.Visible = False

End Sub
Aug 13 '07 #7
Can you post the code you put in?
Nevermind, I got your code to work. Thanks a lot for the help.
Aug 13 '07 #8
Rabbit
12,516 Expert Mod 8TB
Nevermind, I got your code to work. Thanks a lot for the help.
Not a problem, good luck.
Aug 13 '07 #9

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

Similar topics

3
by: Mark | last post by:
Hi there, I have a subform, set as a continuous form. When a user selects a particular record in that subform, how can I make that particular record stand out (color or font change, size, etc) from...
3
by: Bob Darlington | last post by:
I have a subform (one of 3) on a main (unbound) form. The problem sf is the first one on the form, and one the user uses to select a record on which data in the other 2 sf's are based. All sf's...
9
by: Karl Roes | last post by:
Hi All, I would like some advice on Next / Previous record buttons. I have a main form for the client, and a continuous subform listing client transactions. If I open one of these transactions...
1
by: SorboPos | last post by:
Hi. I have a form with continuous forms and a data entry section in the header of the form. (I.e. all transactions show in the main form area like a data sheet and the data for the highlighed...
6
by: F-13 | last post by:
I'm working on a BOM in Access 200 from an example downloaded from from the web. The sample database contains three tables, Assemblies (the list of items needed to assemble any assembly),...
1
by: AP | last post by:
Is there a way to change a subform from single view to continuous view without switching back to design view. I have used the run command in the past to switch to datasheet view, but cant seem to...
3
by: Typehigh | last post by:
I am a good programmer, but this one stumps me! I have a form with a continuous subform. The continuous subform contains records of data and may reach a depth of 1000's of entities. I have...
1
by: Simon | last post by:
Dear reader, How can I move the record pointer in a sub form. The sub form is a datasheet type. Both forms have the same reference key. How can I move the record pointer in the sub form...
5
by: dzulai | last post by:
i have a continuous subform and its AllowAdditons and AllowEdits property are set to false. A command button("Add") in my main form sets both properties to True, enabling the New Record to appear. My...
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
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: 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
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...

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.