Fordraiders
asked on
i just want to make sure the subform is currently selected
i need to get values from a subform.
Before that happens, i just want to make sure the subform is currently selected ?
if not then i need to flag them to select a row in the subform ?
Me!SubformName.Form.Curren tRecord ?
Thanks
fordraiders
Before that happens, i just want to make sure the subform is currently selected ?
if not then i need to flag them to select a row in the subform ?
Me!SubformName.Form.Curren
Thanks
fordraiders
How about
Form_NameOfYourSubform.SetFocus
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Getting a value from a subform record from the parent form or a different form is questionable at best. How do you know what subform record you need the value from and why does a parent form need one value out of many? I would rethink this process carefully. If you tell us what you want to do with the selected value, we might be able to give you a better idea.
As Anders mentioned, the subform ALWAYS has a current record. When the subform opens, the current record will be the first record in the recordset. If the user moves focus into the subform and clicks into record 4 which makes record 4 now the current record and then goes back to the main form to do whatever you are trying to do, the current record of the subform is still #4 so your code would address #4 rather than #1 in this case.
As Anders mentioned, the subform ALWAYS has a current record. When the subform opens, the current record will be the first record in the recordset. If the user moves focus into the subform and clicks into record 4 which makes record 4 now the current record and then goes back to the main form to do whatever you are trying to do, the current record of the subform is still #4 so your code would address #4 rather than #1 in this case.
ASKER
Ok,@anders/pat
There should be no need to add extra code, except perhaps to make sure that there is at least one record (besides the empty/newrecord) in the subform.
Yes, This is would be good also to make sure.
There should be no need to add extra code, except perhaps to make sure that there is at least one record (besides the empty/newrecord) in the subform.
Yes, This is would be good also to make sure.
If you want to make sure that an "actual" record is select as opposed to a new record (In theory, it might not matter whether there ARE records, if the selected record is a new/blank record.
So, we can check whether that is the case by the use of NewRecord property:
So, we can check whether that is the case by the use of NewRecord property:
If Me!SubformName.Form.NewRecord=True then
Msgbox "Please Select a record in the subform. If no record exists, then please create an entry before continuing."
Exit sub
End If
@Fordraiders,
This discussion would be so much more productive if you would only tell us what your end goal is. The end goal is not - get a piece of data from a sub form. The end goal is what you are going to do with that data once you get it.
This discussion would be so much more productive if you would only tell us what your end goal is. The end goal is not - get a piece of data from a sub form. The end goal is what you are going to do with that data once you get it.
ASKER
Thanks all..
Open in new window