SubForm action

BobNTN

Registered User.
Local time
Today, 15:52
Joined
Jan 23, 2008
Messages
314
I have a single page form with main and subform.
On the left I choose a customer then tab to the sub form to input a payment.
The subform shows all payments made by the selected customer. However, when tabbed to the sub form, it goes to the oldest record. I need it to go to 'next' or new record for input.
I've changed everything that sounds like it might work but...
Is this doable ?

Attached view

PayForm.jpg
 
In main form's module use your subform Enter event:
Code:
Private Sub sfmSubForm_Enter()
   DoCmd.GoToRecord , , acNewRec
End Sub
 
Thanks Fernando
works like a charm!

That's what's so great about this forum. You guys know what you're doing

BTW
I was told on a forum that all forms and reports should be built from a query. This doesn't seem practicle since, for instance, if using the form wizard, it won't let you build a form on an update or append query.
What's the thinking behind this ?
 
You cant bound either an update or append query because it doesn't return any records to see. It just performs the action of update or append the record u wanted to. That is why you can only use Select queries to bound to a form.

I think when they said you should built from query they meant that if you are going to make a form where its going to display for example employees ordered by name and, instead of bounding it to a table and use the orderby property, bound it to a query that only shows the employees ordered by name.

I don't really know why but in my experience it makes it easier to maintain or to do any update in the future.
 
Last edited:
In main form's module use your subform Enter event:
Code:
Private Sub sfmSubForm_Enter()
   DoCmd.GoToRecord , , acNewRec
End Sub

Sorry to have to bump this back up but after doing the above, not because of, after inputting a payment, I now need to go back to the Name text box (in the main form) to look up a different customer. ???
 
Hi, from what i understand is that you cant go back to the main form, is that the problem?
 
Well I can click back in it but I guess it's called lost it's focus because then I can't scroll down the name field ?
 
You mean scroll down when using the mouse wheel to change to another customer record?
 
correct
I can before I enter the subform but once I go to the subform, if I click back in a field on the main form, it doesn't move any record.
 
I tried to recreate your db and i didn't have that problem, check if you have it. If you dont have problems with this db, upload your db if you can, or post your code and table information.
 

Attachments

Well, I went thru all events and such changed a couple of things out of curiosity, compacted and restarted, it now works.
Have no idea what I did.
I am sorry and apologize for your time spent Fernando but appreciate your efforts and help.
 

Users who are viewing this thread

Back
Top Bottom