Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / March 2005

Tip: Looking for answers? Try searching our database.

Data Entry mode does not work in subform.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Frank Martin - 28 Mar 2005 01:50 GMT
I have a subform "SuppTxnsSUB" based on the tblSuppTxns, and a particular
supplier's transactions are selected vis a plain combo box (no wizard) by
having the combo as the Master to the "SuppTxnsSUB"'s Child.

This works well.

My aim is to go to a new record in the subform for a combo-selected
supplier, and I hoped to do this by making the tblSuppTxns "DateEntry" set
to 'yes' in the properties.

But this does not seem to work when a table is expressed in a subform!  Why?

To get around this I put some code behind the subform's "OnEnter" property
as follows:

" RunCommand acCmdRecordsGoToNew"

This works well if a supplier has previous transactions in the recordset,
but fails completely for a new supplier with no records as yet and this
gives an error
"unable to goto new".

How can I end up with the cursor in a new record in "SuppTxnsSUB" even if
there are records present or not?

Plesae help, Frank


Arvin Meyer - 28 Mar 2005 13:33 GMT
You can't go to a new record if you are already at one. There is a NewRecord
property of a form that you can check first (aircode):

Sub Form_Current()
If Me.NewRecord = True Then
   Me.FirstControlName.SetFocus
Else
   DoCmd.RunCommand acCmdRecordsGoToNew
   Me.FirstControlName.SetFocus
End If
End Sub
Signature

Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access

> I have a subform "SuppTxnsSUB" based on the tblSuppTxns, and a particular
> supplier's transactions are selected vis a plain combo box (no wizard) by
[quoted text clipped - 22 lines]
>
> Plesae help, Frank
Frank Martin - 29 Mar 2005 06:59 GMT
Thank you.  I have tried this code (as several variations) to no avail.

The best I have come up with is:
*****
Private Sub CreditorsSuppTxnsSUB_Enter()

If Me.NewRecord = True Then
   Me.[CreditorsSuppTxnsSUB].[Form]![AddressesID].SetFocus
Else
   DoCmd.RunCommand acCmdRecordsGoToNew
   Me.[CreditorsSuppTxnsSUB].[Form]![AddressesID].SetFocus
End If

End Sub
********

which stubbornly refuses to work.

I wonder if you can give me some fresh ideas?
Regards.

> You can't go to a new record if you are already at one. There is a
> NewRecord
[quoted text clipped - 37 lines]
>>
>> Plesae help, Frank
Andreas - 29 Mar 2005 07:28 GMT
If Me.NewRecord = True
You are checking the mainform, rather than the subform.

Try something like (untested):
If Me.[CreditorsSuppTxnsSUB].[Form].NewRecord = True

Same goes for adding a new record.

Regards,
Andreas

> Thank you.  I have tried this code (as several variations) to no avail.
>
[quoted text clipped - 60 lines]
>>>
>>>Plesae help, Frank
Frank Martin - 29 Mar 2005 08:52 GMT
Thanks, I have settled on:

*****
Private Sub CreditorsSuppTxnsSUB_Enter()
   Me.CreditorsSuppTxnsSUB.Form!AddressesID.SetFocus
   If Not Me.CreditorsSuppTxnsSUB.Form.NewRecord Then
       DoCmd.RunCommand acCmdRecordsGoToNew
   End If
End Sub

*******
Which works rather well

> If Me.NewRecord = True
> You are checking the mainform, rather than the subform.
[quoted text clipped - 75 lines]
>>>>
>>>>Plesae help, Frank
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.