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

Edit single record in continuous subform

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


Rabbit
Expert Mod 10K+
P: 12,392
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

P: 8
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
Expert Mod 10K+
P: 12,392
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

P: 8
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
Expert Mod 10K+
P: 12,392
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

P: 8
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

P: 8
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
Expert Mod 10K+
P: 12,392
Nevermind, I got your code to work. Thanks a lot for the help.
Not a problem, good luck.
Aug 13 '07 #9

Post your reply

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