you can also use the form Before Insert event to not allow another
record if there already is one -- something like:
Private Sub Form_BeforeInsert(Cancel As Integer)
'180119 strive4peace
If Me.Recordset.RecordCount >= 1 Then
MsgBox "You may only enter one record", , "Aborting new record"
Cancel = True
DoCmd.RunCommand acCmdRecordsGoToLast
End If
End Sub
have an awesome day,
crystal
On 1/19/18 9:56 PM, crystal 8 wrote:
> hi Jim,
>
> additionally, for the subform set the form Cycle property to -->
> Current Record
>
> (default is All Records)
>
> have an awesome day,
> crystal
>
> On 1/19/18 9:05 AM, Liz Ravenwood liz_ravenwood@beaerospace.com
> [MS_Access_Professionals] wrote:
>> I had a similar incident and I had to change the users behavior
>> options under the file drop down for the "enter" key to not go to a
>> new record.
>>
>> Respectfully,
>> [RCEmailSigLogo]
>> Liz Ravenwood
>> Information Technology
>> Interior Systems
>> Rockwell Collins
>> 1851 So. Pantano Rd, Tucson, AZ 85710 USA
>> (520) 239-4808
>> Liz_ravenwood@beaerospace.com<mailto:Liz_ravenwood@beaerospace.com>
>> rockwellcollins.com<http://www.rockwellcollins.com/>
>>
>> From: MS_Access_Professionals@yahoogroups.com
>> [mailto:MS_Access_Professionals@yahoogroups.com]
>> Sent: Thursday, January 18, 2018 9:31 PM
>> To: MS_Access_Professionals@yahoogroups.com
>> Subject: Re: [MS_AccessPros] Limit subform to only 1 record
>>
>>
>>
>>
>>
>> Jim,
>>
>>
>>
>> I would add some code to count the records and if there are any, set
>> the allow additions of the the subform to False.
>>
>>
>>
>> Regards,
>>
>> Duane Hookom
>>
>> ________________________________
>> From:
>> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals@yahoogroups.com>
>> <MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals@yahoogroups.com>>
>> on behalf of luvmymelody@yahoo.com<mailto:luvmymelody@yahoo.com>
>> [MS_Access_Professionals]
>> <MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals@yahoogroups.com>>
>> Sent: Thursday, January 18, 2018 5:22 PM
>> To:
>> MS_Access_Professionals@yahoogroups.com<mailto:MS_Access_Professionals@yahoogroups.com>
>> Subject: [MS_AccessPros] Limit subform to only 1 record
>>
>>
>>
>> Hello all,
>>
>>
>>
>> We support a database that has a Form with a sub form. I have yet
>> figured out how the users are creating a second record in the
>> subform. I have hid the navigation buttons so they cannot click new
>> record or navigate to another record. The subform is linked on Person
>> Id in the main form to the Person Id in the subform.
>>
>>
>>
>> I thought if I try and limit the subform to only allow the TOP 1
>> records that would work. or try and code the OnCurrent event to stop
>> allow.additions from happening I would solve it. But neither of these
>> are working.
>>
>>
>>
>> Without being able to replicate the users adding records to the
>> subform I am at a loss on how to fix the issue. Is there a way of
>> limiting the form to only 1 record?
>>
>>
>>
>> the main form is all active employees. the subform is the employees
>> schedule and hours they work.
>>
>>
>>
>> Thank You for your help
>>
>>
>>
>> Jim Wagner
>>
>>
>>
>>
>
Posted by: crystal 8 <strive4peace2008@yahoo.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (5) |
Tidak ada komentar:
Posting Komentar