RE: Link a text box to combo boxes on a form.
- From: mark <mark@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 14 Dec 2006 11:41:02 -0800
here is what I put in the Control Source section of the Textbox window in the
form:
=DLookup("[Estimate]","Shell & Motiva","[Project]="&Me![Project])
in order of appearence of equation:
Estimate being the field items I need displayed in the textbox (as a project
is chosen with combo box)
Shell & Motiva being the query that contains the field mentioned above that
has the estimates
Project being the field that is reperated in tables and queries...the common
link
the last "Project" listed in the equation is the name of the combo box on
the form.
no spaces in any of the equation..9except the spaces in the field names or
query names
I still get the #name?
this is some frustrating stuff..hahahaha
"Sprinks" wrote:
Mark,.
My bad. Try the expression preceded by the equal sign:
=DLookup("[FieldYou'reLookingUp]", "SourceTableorQuery", "[LinkingField] = "
& Me![ControlOnCurrentFormWithLinkingFieldData])
Sprinks
"mark" wrote:
ok....i tried both expressions and neither work..but i do not think i gave
enough (or proper info)....lited is all the vital info im dealing with:
In the Form ...the combo box is linked (in the "row source" area of
properties window) to a query called "Query from FCR Form" <without quotes of
course>. the title of the combo box is called PROJECT.
The textbox in the form needs to display values from a query titled Shell &
Motiva...the field that holds the estimated cost is titled ESTIMATE in this
Shell & Motiva query......this query is pulling info from a table titled Work
Package Raw Data
so basically when I chose a project from the combo box the estimate for that
project will be displayed in the textbox.
I hope that is more clear......Im trying all your expressions with the
correct titles of course and I get the "#name" message.
"Sprinks" wrote:
Mark,
How is the RecordSource of your main form related to Raw Data CUI? Do they
have a common field? If they do, place a subform on the main form linked by
the common field. By "linked", I mean setting the subform's LinkMasterFields
and LinkChildFields properties.
Alternatively, you could use the DLookup function as the ControlSource for a
main form textbox:
DLookup("[Estimate]", "Raw Data CUI", "[ProjectNumber] = " &
Me![YourProjectNumberControl])
This presumes that your matching field in the Raw Data CUI is named
ProjectNumber, and that it is a number. If it's text, you need single quotes
around the value:
DLookup("[Estimate]", "Raw Data CUI", "[ProjectNumber] = " & "'" &
Me![YourProjectNumberControl] & "'")
Sprinks
"mark" wrote:
clear as mud..hahaha...thanx for your help but I did not figure it out yet.
The table involved in the Project Estimate is a table titled Raw Data
CUI......and I want the textbox to display the field called "Estimate" in the
Project Estimate Query.
the textbox is in the form.....when I chose a project in the combo box I
would like to see estimate displeyd in a textbox.
Im trying all kinds of expressions in the properties window of the text
box....still cant figure it out yet.
"Sprinks" wrote:
Mark,
Textboxes do not "link", they *display* information--either a field in the
form's underlying RecordSource, or the result of an expression.
What table(s) are involved in the "Project Estimate" query? If they are
fields in your Projects table, from which your main form is derived,
presumably, simply add them to your main form query, and place bound controls
on the main form.
If they are in a 2nd table, in order to relate the estimate to the project,
you need to have the main table's Primary Key as a field (called a foreign
key in the second table). Then create a subform based on the ProjectEstimate
query (be sure to include the foreign key as a field in the query) and set
the subform's LinkMasterFields and LinkChildFields properties to the name of
the linking field in the main and subform, respectively.
Hope that helps.
Sprinks
"mark" wrote:
I have a form that has a combo box which is linked to a Query. The field it
is linked to in the Query is titled "PROJECTS" ,without quotes of course>
(which contains the titles of all the projects I am working on).
Also there is a Subform on this Form which is linked to a Query titled
"Query for FCR form" (which contains the change order information for all the
projects).
So now when I chose a job in the Combo Box, all the information for the
particular job populate in the subform.
What I would like to see on this form now is the project estimate which is
on its own Query.
I put a textbox in the form which Im attempting to link to a field in the
Project Estimate query and also link it to the combo box I mentioned.
So basically, I want to be able to chose a job in the combo box.....have all
the change order information show up (which is what I have thus far), but I
ALSO want to have the project estimate show up in a text box off to the side.
here are the queries in question:
combo box row source is - "Query for FCR Form"...without quotes..(this
gives me my list of projects)
"Project Estimate" ..without quotes..this query has the project estimates
listed in a field titled Phase 1 and 2 combined
im sure that the textbox has to be linked between these two
queries...correct??
Can someone please help?
Mark
- Follow-Ups:
- RE: Link a text box to combo boxes on a form.
- From: Sprinks
- RE: Link a text box to combo boxes on a form.
- References:
- RE: Link a text box to combo boxes on a form.
- From: Sprinks
- RE: Link a text box to combo boxes on a form.
- From: mark
- RE: Link a text box to combo boxes on a form.
- From: Sprinks
- RE: Link a text box to combo boxes on a form.
- From: mark
- RE: Link a text box to combo boxes on a form.
- From: Sprinks
- RE: Link a text box to combo boxes on a form.
- Prev by Date: Re: using formulas in text fields
- Next by Date: Re: DSUM with AND in access
- Previous by thread: RE: Link a text box to combo boxes on a form.
- Next by thread: RE: Link a text box to combo boxes on a form.
- Index(es):
Relevant Pages
|