Subform/ subreport Query data row number reference

Trees

Registered User.
Local time
Today, 02:14
Joined
Jul 15, 2005
Messages
13
I am new to this and i may be going about this the wrong way but what i am doing seems to do the job until now.

I am making a form that has a combo box, a few text boxes and a subform\ subreport on it.

The idea is that the first thing a user does is to select a name form the combo box. this name is then stored as a sring and used to set the forms record source and then the subform's (called window) source object. the string is slightly modified during the process to do this. That part works fine.

The problem arose when i included text boxes to show infomation from the selected Query thatisant show in the window (subform).

After the user selects a name and the name is used to set up the record source and the source object for the text boxes.it then displays in the text boxes the records extra data. however it only displays the first row extra data.And when other rows in the query table are selected the data in the text box stays set as the first row.


I know that this is because i haven't programed in an event that makes the text box data update when the user selects a new row.

i also realise that i would need to have some way of know what row of the quiery table the user is looking at to be able to update the text boxes.

my questions are

Is there a way to tell what row of a query table in the subform is selected ?

Is there an event similar to on selection of row or something like that that i could use to reload the text boxes?

and finaly

am i going about this the right way?

Any input on this would be greatly appreciated :)
 
am i going about this the right way?
Maybe and maybe not! :D Hard to tell with the few details provided so far.
Is there a way to tell what row of a query table in the subform is selected ?

Is there an event similar to on selection of row or something like that that i could use to reload the text boxes?
Yes: Current Event of the SubForm is the answer to both questions.

If you would post some specific details, I'm certain someone could supply some specific answers.
 
I am using VBA and can't find the current event for the sub form . Is this just a VB event?
i can only see the on enter and on exit events. :(

here is the code for my combobox selection and update of the subform and text boxes.

Private Sub cmboStaff_Change()

Sm = cmboStaff.Text
window.Visible = True
Sm = Sm + " jobs"
Form_Main.RecordSource = Sm
Sm = "query." + Sm
window.SourceObject = Sm
txtClientName.ControlSource = "Client"
txtEmail.ControlSource = "Email"
txtMr.ControlSource = "Mr"
txtName.ControlSource = "Name"
txtPhone.ControlSource = "phone"
txtFax.ControlSource = "Fax"
txtMobile.ControlSource = "Mobile"

End Sub

where the subform is called window
and txt's are text boxes.

The txtX.controlSource= "X" allways refers to the first entry. and i need the text boxes contence to change when the user selects a differnt row in the query displayed in the subfom.

im not sur how i can do this i think i may be limited by VBA or just limited by my knowledge.. :(

I hope this helps people understand my problem more

Any input is greatly appreaciated :)
 
i have just found that if i don't enable the subform the user cannot select anything on it (obviously)which is undesireable. but on the upside is that if the user scrolls the mouse wheel the text boxes data cahnges to diffrent rows in the query?? :confused:

perhaps i could use this because having the subform un enabled would prevent some erroneous data from bging enterd . but i would still like to know if anyone know of a way to get the row number of a query so it could work if the subform was enabled.
because being able to edit the subform is a desired function of the form. :)
 
Here's a reference to a site that has resolved the MouseWheel problem: Mouse Wheel On/Off

i can only see the on enter and on exit events.
You are probably looking at the SubFormControl, not the SubForm.

and finaly

am i going about this the right way?
Right now I would have to say probably not!

It seem as though you are doing a lot of yanking around of the Control Source's of the textboxes. Perhaps if you described the "real world" use of this combobox I would have a better idea on how to proceed.
 
I have realised that the way i am directly putting in a query to the subfom is not the best way to do it and that i would gain more controll by putting in a subform that contains the query instead.

i was just setting the sub forms control to a query.
that is why i didn't have the subform options just the subform control because there was no subform :eek: .

The "real world" function of the combo box is to kind of search by the option selected.
the combo box options are the names of staff. there are quierys in the db call "staffname jobs" for each mamber of staff the quiery contains the jobs that they are responable for atm and other data. the query is just a summery of the jobs and i intend to have more deatils about the jobs in the textboxes.
the more infomation is in the query but hidden for the puppose of being a summery table view.

i think i might be able to solve my problems by actually having a subform and then getting what i need to know from that subform.

Thanks again for your help
 

Users who are viewing this thread

Back
Top Bottom