Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pullling specific fields on ENTER

Status
Not open for further replies.

Dre313

Technical User
Jun 4, 2003
219
US
HI,

I have a form which has a subform inside.. In this sub-form I have my table of records.. each of these records has sub-records .. What I want to do is.. let the user highlight whichever record he/she wants to see sub-records for.. each record has 7 fields.. out of those 7.. 3 of those fields make the record unique.. hit enter and a window would pop up with those particular sub-records ..

I fairly new .. soo if youcould explain in detail.. that would be great..


thanks

 
I have each sub-record stored in a 1 query.. I need to know how to to obtain the sub-records only for that particualr record..

 
What you are going to want to do is this:

1. Create a form with the fields that you want to pop up on the form; make sure you have the linking ID on the form just make sure it is not the original ID number.

2. Make sure your form's data comes from that query that you were speaking of. Click anywhere on the form, then right-click the little black square in the upper left hand corner of the form, and click properties if the properties window isnt visible. Look at the tab Data and check to see if it is right. Click the "..." to get the right data.

3. Now go to your sub form and create a button that opens another form. Use the Tool wizard that comes with Access to create the button that will open the form with data corresponding to the already present data. Check your button's click event to see if the code there is similar to this:

Private Sub cmdOpenForm_Click()
On Error GoTo Err_cmdOpenForm_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "FormToBeOpened"

stLinkCriteria = "[LinkingIDControlName]=" & Me![MainIdControlName]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdOpenForm_Click:
Exit Sub

Err_cmdOpenForm_Click:
MsgBox Err.Description
Resume Exit_cmdOpenForm_Click

4. Okay now go to your form that is going to be opened and look at the properties there. Go to the Event tab and click the form_load line then click the ellipse next to the line then the code builder. Paste this code in there:

Me![LinkingID] = Forms![MainFormName]![MainIDControlName]

That should be all that you need to open that form with data link to your current forms information. Good Luck and let me know how it works

If I take a peek in your Windows, to fix a problem, does that make me a "Peeping Tom"? Hmmmmmmmmmm
 
great info... thanks for the response.. I will give it a go .. I'll keep you updated..

thanks
 
docmeizie ,

ok an update of what i have done.. What I did was created a form which is linked to my query.. with all my sub-records..

on my original form I have listed all my records in a sub-form.. now all the user has to do is.. scroll through the records.. highlight the record that they want to see sub-records for and hit enter.. when the user hits "enter" my form that i just created comes up listing all subrecords for that particualy record.. (I'm using the criteria "Forms!Mainformname!Subformname.form!Field1Name" for uniqueness on my query)

it does work.. but What i want is.. for the subrecords to be displayed all at once.. not just one by one..

how can i do that ? thanks

 
Set the view of the form to "Datasheet" or either "Continuous Form". That is located under the Format tab of the Properties box. It is about 3,4, or 5 lines down.

If I take a peek in your Windows, to fix a problem, does that make me a "Peeping Tom"? Hmmmmmmmmmm
 
I gotcha.. thanks for the help.. I have another question if you dont mind..

On a forms caption.. Is there a way I can add the unique field names to that title .. instead of having it repeat how ever many times there are subrecords..

that way I can display once the title say...

on the caption of the form..

"Sub-Record : Unique Field1, Unique Field2, Unique Field3"

and underneath all that would be listed would be the sub-record info?

thanks you been great help!


I tired..

Code:
me.caption = "Inspections" Me.repaint

but im getting a syntax error...

any ideas ? thanks
 
Ok this was kinda dumb of me.. but i changed..

me.caption = "Inspections" Me.repaint

to

me.caption = "Inspections"
Me.repaint

and it outputs on my caption line.. just "Inspection" how do i get my unique fields on there also ?

thanks
 
Where it says Caption under the Format Tab of the Properties box, the first line. Now I have not tried this b4, but try this:

In the caption line of the Properties box try using concatenation without equal sign. If it does work good, if not then I am out of ideas for that one.

If I take a peek in your Windows, to fix a problem, does that make me a "Peeping Tom"? Hmmmmmmmmmm
 
I got it to work.. !

Heres what I did if you wanted to see

me.caption = "Inspections" & Me!Fieldname
Me.repaint


thanks for the help
 
No problem. Congratulations!!!

If I take a peek in your Windows, to fix a problem, does that make me a "Peeping Tom"? Hmmmmmmmmmm
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top