subform suddenly not add-able

P

Peter

Hello everyone,

I haven't been working on one of my databe projects for about two weeks,
being busy with other priorities. Since were talking about a One-Man
developing force here, I have somewhat of an idea where I left off, but not
quite, since the project is not administred to its full extent. Now I'm
encountering the following situation:

When I open my main form, I notice that one of my subforms nog longer
accepts additions to the underlying table. (I don't even remember leaving it
in that state...). First I thought this maybe due to the fact that the
subform was originally based on a table, not a query on that table. So I
made a query on that table and changed the datasource for the subform. This
did not have the desired effect. I remembered I had a number of suquential
backups of said database somewhere and I went back from the last one back
into the sequnece and wha'dya know: I found a version in which I actually
found my main form within which I found the subform in an addable form.

How can I find out what the problem was that tcaused this unwanted effect?

Greetings,
Peter
 
P

Peter

Thanks Allen.

It turned out to be a setting in the properties of the sub form when opened
just by itself , not when editing the control on the main form. The subform
was based on a table, not a query. I have an extra question, however.
The main form has its AllowEdits property set to False by the Current event.
To edit the present record, I have a button on the main form (cmdEditRecord)
and this is its Click event.

Private Sub cmdEditRecord_Click()
With Me
.AllowEdits = True
.cboObjectNums.SetFocus
.imgRecordLockedStatus.Picture = sRECORDUNLOCKED
.lblRecordLockedStatus.Caption = "Unlocked"
End With
'version 1
subf1_T01_AssigmentsPerObject_Subs.Form.AllowEdits = True
'version 2
' Forms("subf1_T01_AssigmentssPerObject_Subs").AllowEdits = True
End Sub

When changes have been made and those need to be committed to the underlying
record, the user can click the cmdSaveRecordButton. This is its Click
event:

Private Sub cmdSaveRecord_Click()
On Error GoTo Err_cmdSaveRecord_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
With Me
.imgRecordLockedStatus.Picture = sRECORDLOCKED
.lblRecordLockedStatus.Caption = "Locked"
End With
With Me.subf1_T01_AssignmentsPerObject_Subs
.Locked = True
Forms("subf1_T01_AssignmentsPerObject_Subs").AllowEdits = False
End With

Exit_cmdSaveRecord_Click:
Exit Sub
Err_cmdSaveRecord_Click:
MsgBox Err.Description
Resume Exit_cmdSaveRecord_Click
End Sub

The problem is that these AllowEdits lines do not work for the subform
control that is on the main form, either version 1 or 2. When I set the
property for the form as mentioned at the beginning of this reply, then the
subform can be edited but then all the time. I want that setting to switch
using the buttons. I hope I made clear what I want to do and where I
encounter problems.


Greetings,
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top