A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Setting subform to add mode while main form is in edit mode



 
 
Thread Tools Display Modes
  #1  
Old February 3rd, 2010, 09:07 PM posted to microsoft.public.access.forms
Justin
external usenet poster
 
Posts: 27
Default Setting subform to add mode while main form is in edit mode

Is it possible to have the subform on a main form open in add mode
while the main form is in edit mode?
I have a main form that shows the first and last name of my drivers
while the subform is for entering a date and number of hours on duty
for that date. The subform is beginning to have a large number of
entries and I have to scroll down to the last entry to begin entering
data.

Thanks for your help

Justin
  #2  
Old February 3rd, 2010, 09:35 PM posted to microsoft.public.access.forms
Jeanette Cunningham
external usenet poster
 
Posts: 2,190
Default Setting subform to add mode while main form is in edit mode

Yes, just set the subform's Data entry property to Yes.
This sort of thing you can just try for yourself by changing the setting to
the one you want.
Then test the form/subform to see if it works the way you want.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"Justin" wrote in message
...
Is it possible to have the subform on a main form open in add mode
while the main form is in edit mode?
I have a main form that shows the first and last name of my drivers
while the subform is for entering a date and number of hours on duty
for that date. The subform is beginning to have a large number of
entries and I have to scroll down to the last entry to begin entering
data.

Thanks for your help

Justin



  #3  
Old February 4th, 2010, 12:36 AM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Setting subform to add mode while main form is in edit mode

On Wed, 3 Feb 2010 12:07:30 -0800 (PST), Justin wrote:

Is it possible to have the subform on a main form open in add mode
while the main form is in edit mode?
I have a main form that shows the first and last name of my drivers
while the subform is for entering a date and number of hours on duty
for that date. The subform is beginning to have a large number of
entries and I have to scroll down to the last entry to begin entering
data.

Thanks for your help

Justin


Sure. Jeanette's suggestion of "Data Entry" will work.

However, it has the disadvantage that if Data Entry is set to Yes, then that's
ALL you can do - add new records - and you won't see any existing ones.

As an alternative, you can use the Load event of the subform to jump to the
new record:

Private Sub Form_Load()
DoCmd.GoToRecord, , acNewRecord
End Sub
--

John W. Vinson [MVP]
  #4  
Old February 4th, 2010, 01:45 PM posted to microsoft.public.access.forms
Justin
external usenet poster
 
Posts: 27
Default Setting subform to add mode while main form is in edit mode

On Feb 3, 6:36*pm, John W. Vinson
wrote:
On Wed, 3 Feb 2010 12:07:30 -0800 (PST), Justin wrote:
Is it possible to have the subform on a main form open in add mode
while the main form is in edit mode?
I have a main form that shows the first and last name of my drivers
while the subform is for entering a date and number of hours on duty
for that date. The subform is beginning to have a large number of
entries and I have to scroll down to the last entry to begin entering
data.


Thanks for your help


Justin


Sure. Jeanette's suggestion of "Data Entry" will work.

However, it has the disadvantage that if Data Entry is set to Yes, then that's
ALL you can do - add new records - and you won't see any existing ones.

As an alternative, you can use the Load event of the subform to jump to the
new record:

Private Sub Form_Load()
DoCmd.GoToRecord, , acNewRecord
End Sub
--

* * * * * * *John W. Vinson [MVP]


Your method is what I was shooting for John. I had looked at
Jeanette's method before, but wasn't sure that it was what I really
wanted. Thanks to the both of you for helping to educate another
novice.

Justin
  #5  
Old February 4th, 2010, 02:49 PM posted to microsoft.public.access.forms
Justin
external usenet poster
 
Posts: 27
Default Setting subform to add mode while main form is in edit mode

On Feb 4, 7:45*am, Justin wrote:
On Feb 3, 6:36*pm, John W. Vinson
wrote:



On Wed, 3 Feb 2010 12:07:30 -0800 (PST), Justin wrote:
Is it possible to have the subform on a main form open in add mode
while the main form is in edit mode?
I have a main form that shows the first and last name of my drivers
while the subform is for entering a date and number of hours on duty
for that date. The subform is beginning to have a large number of
entries and I have to scroll down to the last entry to begin entering
data.


Thanks for your help


Justin


Sure. Jeanette's suggestion of "Data Entry" will work.


However, it has the disadvantage that if Data Entry is set to Yes, then that's
ALL you can do - add new records - and you won't see any existing ones.


As an alternative, you can use the Load event of the subform to jump to the
new record:


Private Sub Form_Load()
DoCmd.GoToRecord, , acNewRecord
End Sub
--


* * * * * * *John W. Vinson [MVP]


Your method is what I was shooting for John. I had looked at
Jeanette's method before, but wasn't sure that it was what I really
wanted. Thanks to the both of you for helping to educate another
novice.

Justin


Guess I should have tried it before I responded. I put your code in
the Load event of the subform and it hangs up. Should this code go
into another event in addition to the load event? I copied the code
and pasted it into the event and it didn't give an error until I tried
to open the main form. The run-time error 2105 comes up saying that
"you can't go to the specified record".
Thanks again for you help.

Justin
  #6  
Old February 4th, 2010, 07:09 PM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Setting subform to add mode while main form is in edit mode

On Thu, 4 Feb 2010 05:49:55 -0800 (PST), Justin wrote:

Guess I should have tried it before I responded. I put your code in
the Load event of the subform and it hangs up. Should this code go
into another event in addition to the load event? I copied the code
and pasted it into the event and it didn't give an error until I tried
to open the main form. The run-time error 2105 comes up saying that
"you can't go to the specified record".
Thanks again for you help.


My mistake! I didn't test it myself... that will happen (I'm guessing) if
there are no records in the subform at all. Let me think about this and I'll
get back to you - or does anyone else have a solution handy? I know this has
been done!
--

John W. Vinson [MVP]
  #7  
Old February 4th, 2010, 07:48 PM posted to microsoft.public.access.forms
Justin
external usenet poster
 
Posts: 27
Default Setting subform to add mode while main form is in edit mode

On Feb 4, 1:09*pm, John W. Vinson
wrote:
On Thu, 4 Feb 2010 05:49:55 -0800 (PST), Justin wrote:
Guess I should have tried it before I responded. I put *your code in
the Load event of the subform and it hangs up. Should this code go
into another event in addition to the load event? I copied the code
and pasted it into the event and it didn't give an error until I tried
to open the main form. The run-time error 2105 comes up saying that
"you can't go to the specified record".
Thanks again for you help.


My mistake! I didn't test it myself... *that will happen (I'm guessing) if
there are no records in the subform at all. Let me think about this and I'll
get back to you - or does anyone else have a solution handy? I know this has
been done!
--

* * * * * * *John W. Vinson [MVP]


There are already records in the subform, so I don't think that's it.
Until later, thanks.

Justin
  #8  
Old February 4th, 2010, 07:52 PM posted to microsoft.public.access.forms
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default Setting subform to add mode while main form is in edit mode

"John W. Vinson" wrote in message
...
On Thu, 4 Feb 2010 05:49:55 -0800 (PST), Justin
wrote:

Guess I should have tried it before I responded. I put your code in
the Load event of the subform and it hangs up. Should this code go
into another event in addition to the load event? I copied the code
and pasted it into the event and it didn't give an error until I tried
to open the main form. The run-time error 2105 comes up saying that
"you can't go to the specified record".
Thanks again for you help.


My mistake! I didn't test it myself... that will happen (I'm guessing) if
there are no records in the subform at all. Let me think about this and
I'll
get back to you - or does anyone else have a solution handy? I know this
has
been done!



Current event of the main form ought to do it. E.g,

Private Sub Form_Current()

Me.sfSubformName.Form.Recordset.AddNew

End Sub

(Access 2000 or later)

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

  #9  
Old February 4th, 2010, 08:02 PM posted to microsoft.public.access.forms
Justin
external usenet poster
 
Posts: 27
Default Setting subform to add mode while main form is in edit mode

On Feb 4, 1:52*pm, "Dirk Goldgar"
wrote:
"John W. Vinson" wrote in messagenews:uo2mm5hjvrkl0k3o36b86pd73604jg5k71@4ax .com...



On Thu, 4 Feb 2010 05:49:55 -0800 (PST), Justin
wrote:


Guess I should have tried it before I responded. I put *your code in
the Load event of the subform and it hangs up. Should this code go
into another event in addition to the load event? I copied the code
and pasted it into the event and it didn't give an error until I tried
to open the main form. The run-time error 2105 comes up saying that
"you can't go to the specified record".
Thanks again for you help.


My mistake! I didn't test it myself... *that will happen (I'm guessing) if
there are no records in the subform at all. Let me think about this and
I'll
get back to you - or does anyone else have a solution handy? I know this
has
been done!


Current event of the main form ought to do it. *E.g,

* * Private Sub Form_Current()

* * * * Me.sfSubformName.Form.Recordset.AddNew

* * End Sub

(Access 2000 or later)

--
Dirk Goldgar, MS Access MVP
Access tips:www.datagnostics.com/tips.html

(please reply to the newsgroup)


I placed this line of code in the Form Load and Form Current and it
seems to work like I want it to.

DoCmd.GoToRecord , , acNewRec

Thanks for all the help guys. Maybe one day I can give back to the
group as well.

Justin Thomas
  #10  
Old February 5th, 2010, 12:21 AM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Setting subform to add mode while main form is in edit mode

On Thu, 4 Feb 2010 13:52:33 -0500, "Dirk Goldgar"
wrote:

Current event of the main form ought to do it. E.g,


Thanks much, Dirk - I was going to test it out that way, but looks like you
nailed it!
--

John W. Vinson [MVP]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:09 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.