open subform for editing

  • Thread starter Thread starter John Fennell
  • Start date Start date
J

John Fennell

I have changed the main form allow edits to no then I created a command
button with the following code to open the form for edits. The sub form
doesn't open. What lines of code must I enter to open the subform for
editing. Do I have to re write the code to make this happen. If so HELP.

Thanks for responding
Private Sub cmdEditRecord_Click()
Dim ctl As Control
Dim lngBackColor As Long
Me.AllowEdits = Not (Me.AllowEdits)
If Me.AllowEdits = True Then
Me!cmdEditRecord.Caption = "Lock"
lngBackColor = vbCyan
Else
Me!cmdEditRecord.Caption = "Edit Record"
lngBackColor = vbWhite
End If
For Each ctl In Me.Controls
If TypeOf ctl Is TextBox Or TypeOf ctl Is ComboBox Then
ctl.BackColor = lngBackColor
End If
Next ctl
'CurrentDate.SetFocus
End Sub
 
Hi John,

You have to set the subForm control's AllowEdits = True, example:

Me.AllowEdits = Not (Me.AllowEdits)
Me.[subform control].Form.AllowEdits = Not(Me.[subform
control].Form.AllowEdits)

I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support

"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."


--------------------
| Reply-To: "John Fennell" <[email protected]>
| From: "John Fennell" <[email protected]>
| Subject: open subform for editing
| Date: Sun, 29 Feb 2004 14:06:01 -0600
| Lines: 26
| Organization: Thunder Networking
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.access.forms
| NNTP-Posting-Host: c-66-41-58-219.mn.client2.attbi.com 66.41.58.219
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.access.forms:257374
| X-Tomcat-NG: microsoft.public.access.forms
|
| I have changed the main form allow edits to no then I created a command
| button with the following code to open the form for edits. The sub form
| doesn't open. What lines of code must I enter to open the subform for
| editing. Do I have to re write the code to make this happen. If so HELP.
|
| Thanks for responding
| Private Sub cmdEditRecord_Click()
| Dim ctl As Control
| Dim lngBackColor As Long
| Me.AllowEdits = Not (Me.AllowEdits)
| If Me.AllowEdits = True Then
| Me!cmdEditRecord.Caption = "Lock"
| lngBackColor = vbCyan
| Else
| Me!cmdEditRecord.Caption = "Edit Record"
| lngBackColor = vbWhite
| End If
| For Each ctl In Me.Controls
| If TypeOf ctl Is TextBox Or TypeOf ctl Is ComboBox Then
| ctl.BackColor = lngBackColor
| End If
| Next ctl
| 'CurrentDate.SetFocus
| End Sub
|
|
|
 
Back
Top