specific number of records in a Continuous subform (1 Viewer)

gguy

Registered User.
Local time
Today, 14:28
Joined
Jun 27, 2002
Messages
104
I have a subform called volsub which is continuous and is defined so that it can only be used to add records.

The user knows how many records will need to be added in volsub before he begins entry. Because this is a continuous form the user has to mouse click on a field outside the subform to finish record entry in volsub. The user sees this as a problem.

Would it be possible to have a field in the main form that states how many records will be entered in volsub? Then could volsub only show or allow that many records to be entered and then tab to the next field in the main form that is in the tab order?

If this could be done it would really simplify this forms function.

Thanks for your help. GGuy
 
R

Rich

Guest
Private Sub Form_Current()


Me.txtNum = Form.CurrentRecord
If Form.CurrentRecord > Forms!Recordings!txtNumb Then
Me.AllowAdditions = False
Else
Me.AllowAdditions = True
End If


End Sub
 

Howlsta

Vampire Slayer
Local time
Today, 14:28
Joined
Jul 18, 2001
Messages
180
I'm trying to do a similar thing, but I need to put code in the AfterUpdate event of a text box that indicates how many records will go into the subform. What is the correct syntax to set allowadditions in a subform, as the code is in the main forms module. At the moment i'm trying this without avail:

Forms![PBChildren]![PBchildinfo Subform].allowadditions = False

it says it doesn't support the property

full code is

Private Sub txtChildNum_AfterUpdate()
Dim count
count = DCount("[FORM NUMBER]", "childinfo", "[FORM NUMBER] = '" & Me.[FORM NUMBER] & "'")
'Forms![pbchildren subform]!txtNumchild = Form.CurrentRecord
If count >= txtChildNum Then
Forms![PBChildren]![PBchildinfo Subform].allowadditions = False
Else
Forms![PBChildren]![PBchildinfo Subform].allowadditions = true End If
End Sub


Rich
 
Last edited:

Howlsta

Vampire Slayer
Local time
Today, 14:28
Joined
Jul 18, 2001
Messages
180
Got it now had to insert .form

Forms![PBChildren]![PBchildinfo Subform].Form.AllowAdditions = False
 

gguy

Registered User.
Local time
Today, 14:28
Joined
Jun 27, 2002
Messages
104
Rich,

Thanks, this worked great but at the point where it does Me.AllowAdditions = False I need the code to kick me back to the main form, to the next field in the tab order. Any thoughts? GGuy
 

gguy

Registered User.
Local time
Today, 14:28
Joined
Jun 27, 2002
Messages
104
Okay, I got it, setfocus.

I just needed to dig a little deeper. I included the line forms!mainForm!textbox.setfocus in the false part of the previous if statement and it kick me out of the subform and to the next text box in the tab order of the main form.

Thanks for the help! GGuy
 

Users who are viewing this thread

Top Bottom