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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add subform entries without scrolling 1

Status
Not open for further replies.

DoctorJDM

Technical User
Apr 15, 2007
60
GB
Hi

Have a main form with subform in datasheet view that builds a history of transactions. The history is getting long and it's tedious for users to have to scroll down the list every time when adding records.

What's easiest to resolve this? Tried adding a command button on the main form to set the subform's DataEntry property to True temporarily using this

Forms!frmCoordinators.sfmcoordinatorhours.Form.DataEntry = True

. . . but it returns 'Application-defined or Object-defined error'
 
Not sure why that is not working. I tried this on a form to toggle back and forth between views and it worked fine

Private Sub Command4_Click()
With Me.subFrmChild.Form
.DataEntry = Not .DataEntry
End With
End Sub

Basically it is the same syntax. Most likely you are making a spelling error

In your case try this

Private Sub Command4_Click()
With Me.sfmcoordinatorhours.Form
.DataEntry = Not .DataEntry
End With
End Sub

ensure that sfmcoordinatorhours is spelled correctly
 
Actually you may want a toggle button for this.

Private Sub Toggle5_Click()
If Me.Toggle5 Then
Me.subFrmChild.Form.DataEntry = True
Me.Toggle5.Caption = "Click to Show All"
Else
Me.subFrmChild.Form.DataEntry = False
Me.Toggle5.Caption = "Click for Data Entry"
End If
End Sub
 
How are ya DoctorJDM . . .

. . . and if you move the button and code to the subform? with the following changes in code:
Code:
[blue]  Me.dataEntry = Not Me.dataEntry[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
 
. . . or you may be interested in [blue]puting the new record input line at the top of the form![/blue] See my post in the following thread for the method:

thread702-1309854

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
 
Thanks first to MajP. That's perfect, particularly the toggle button (once I'd thought to give it a starting Caption). My original was very close but I'd made the classic mistake of referring to the subform's Source Object instead of its Name. The toggle idea is much better.

Thanks also to AceMan, as ever, for a useful tip and thread.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top