Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add and Data Entry Control will not work on Subform! 1

Status
Not open for further replies.

mdmarney

IS-IT--Management
Jan 16, 2003
68
US
I would like for users to only be able to add new records on a subform. If I set the DataEntry or Additions controls it doesn't change anything. I'm guessing because the main form is set differently. Is there a work around?
 
In the Main Form:

AllowEdits = True or False, that's up to you
AllowDeletions = True or False, that's up to you
AllowAdditions = False
DataEntry = False

In the Sub Form:

AllowEdits = True
AllowDeletions = True or False, that's up to you
AllowAdditions = True
DataEntry = False
 
Bill,
Tried this and even double checked it with a print out of your email. Subform data is still editable. Any thoughts, anyone??? *************
M. MARNEY
 
Also, controls work fine when subform is pulled up on its own, but when it is inside the other form it is being a bad boy... *************
M. MARNEY
 
Misinterpreted your question, defaults for sub form:

AllowEdits = False
AllowDeletions = False
AllowAdditions = False
DataEntry = False

Have an ADD button on Main Form:
Me!YourSubformName!AllowEdits = True
Me!YourSubformName!AllowAdditions = True
Me!YourSubformName!DataEntry = True

Have a SAVE button on Main Form:
Me!YourSubformName!DataEntry = False
Me!YourSubformName!AllowEdits = False
Me!YourSubformName!AllowAdditions = False


 
The problem is though, I need the subform to DEFAULT to a new record and not show any of the other records. When a user selects the GroupID in the main form, it should pull up a new record in the subform, not showing any of the other records, tied to the main form by GroupID. Pressing buttons is not an option...
Thanks. *************
M. MARNEY
 
Set the properties in the Sub Form to:

AllowEdits = True
AllowDeletions = False
AllowAdditions = True
DataEntry = True
 
Hi mdmarney, if you'd like to zip up you DB and send it to me at billpower@cwcom.net, I'll try and find out what's going on, like I said, specifying DataEntry = True should suppress any existing records from being shown.
 
Hi mdmarney,

In the After Update event of you Combo Box Combo20 add the blue text, this will setfocus to your sub form:

Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[Parish or Group ID] = " & Str(Nz(Me![Combo20], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Me!frm_Add_Attendants_by_Group_Subform.SetFocus

In the On Current Event of your Form add the blue text, this will ensure your Sub Form will always be Data Entry and not display existing records:

Set rs = CurrentDb.OpenRecordset("Select * from tbl_Attendants")
rs.MoveLast
Me.tx_Count_Box = rs.RecordCount
Me!frm_Add_Attendants_by_Group_Subform.Form.DataEntry = True

Thanks for e-mailing me your DB, it makes life so much easier being able to see the problem. Will delete it after sending this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top