How do I position cursor in a subform

Jimcb8

Registered User.
Local time
Today, 09:07
Joined
Feb 23, 2012
Messages
98
I have a combo box in which the user selects the client he want to update.
The top of the form has descriptive data for the client ie. name address etc.

The linked subform (on ClientId), below that descriptive data, displays all of the visits the client has made to our pantry. The fields are:

date attended
# members in household

How do I move the cursor, into the subform called "dates of distribution", to add a new record for the clients current visit. I would like the cursor to be at the new record position for the data entry.
Currently, the user must scroll down to the last record entered to make the new entry.

I tried to set focus to the new record, after the last record in the subform, that is displayed with no success.
My problem is where to put the event procedure so that when the client is selected, it will go to the subform, after the last record that was previously entered is displayed.
I tried goto record new , set focus commands etc.
Which event should I use and what commands, in what order, do I need to code to make this work.

All thoughts will be greatly appreciated. I am new to access and VBA.
 
First up you need to get the correct Syntax for referring to the Sub-form and it's controls.

The second thing is you will need to do this in two steps, first set focus to the Sub-form holder and then to the control you are interested in.
 
Thanks that info is helpful. I still not sure how to implement.
Which event should I use and what commands, in what order, do I need to code to make this work.

Thanks for your reply.

Jim
 
The event you use will be dependant upon when you want to move the cursor to the subform. The code might look something like;

Code:
Me!YourSubForm.Form!ControlName.SetFocus

For the above code you can do it in one step, for other commands you may need to first set the focus to the Subform Holder.
 
The user clicks the client name in the combo box and the subform is filled. I want to set focus to the record after the last record in the subfile(actually that would be and add to the subfile table),


Not sure where that event is?

Thanks
 
OK to go to a New Record you will need the following code:
Code:
Me!YourSubFormHolder.SetFocus
DoCmd.GoToRecord , , acNewRec
 
Last edited:
Thank you so much you are the best. I really appreciate your help.

Jim
 

Users who are viewing this thread

Back
Top Bottom