subform Focus

dynamictiger

Registered User.
Local time
Today, 23:59
Joined
Feb 3, 2002
Messages
270
This is difficult to describe, so please bear with me.

I have a main form, with a subform showing details of swimming pools installed at a property. To add a new pool I make the main form invisible and load the new pool details via a class to the pool table. I then return focus to the subform, highlight the new record and make the main form visible.

All this works fine.

However, the record selector on the subform is stubbornly focussed on the pool prior to the addition even though the highlighting is on the new (correct row). I have tried a few alternative arrangements like using the highlight as the source for the row to drag focus to the correct record but no permutation seems to work, I am at a total loss as to what to try next.
 
How are you currently moving the focus to the pools subform and how many pools can a property have for gods sake - isn't just one enough???:p
 
One property i manage has four. A property I used to manage in NZ had 8.

Manually the user clicks on the pool to enter the relevant data on the main form.
 
When you say highlight, do you mean change the colour or move the focus to that control. Also do you requery / refresh the subform after adding the new pool.

I see you are adding a new pool via a 'class'. Im not quite sure what you mean but as you are hiding the main form (which I assume holds the subform), I assume you are opening a new form.

You can move the focus to the last enterd record by using

DoCmd.GoToRecord , , acLast

you could set the focus to the subform and then use this line to set the focus to the last record

any help?

8 pools - why??
 
8 pools - Leisure Pool, Lap Pool, Indoor Pool, Hydrotherapy Pool, Indoor Spa, Outdoor Spa, Slide Pool and Hot Pool

I have been mucking about with Docmd.goto without success. I will try again setting focus to the form hard code and see if it works. No that didn't work. the record stubbornly stays where it is.

A lot of the forms I use are unbound and use Classes as the engine to retrieve and save records, it enables me to reuse the same form for a myriad of uses. So with one form I can:

Add a new pool
Edit an existing pool
Add a new customer
Edit a customer
Add a new property (for the same customer)
Change owner of the property
etc
 
So you enter a new record via the (new) unbound form?
Do you requery the subform after the addition of the new record before moving the focus?
Have you tried making the mainform visible then setting the focus?

(I'm interested in seeing haw the 'classes' system works if you are willing to share)
 
Yes I requery. I had not thought making the form visible first, I have to go to work now, but will try tonight.

Attached is a text file of my client class.

To use it I would set in the form:

Dim objclient as new clsClient

with objClient

.clientID=me.openargs(or something)

.loadclient

Me.txtFirstName=.firstName

etc
 

Attachments

Thanks dynamic, that is beyond my programming skills but I look forward to attempting to fathom it out!
 

Users who are viewing this thread

Back
Top Bottom