Reference A Fields Values In The Record Source Query

Dec 30, 2007

I have a query on a form that is providing all of the information I need for everything on my form.

The problem is I don't know how to refer to a field's value in the query in VBA without having a hidden text field on the form.

I know I can reference a combo box's query to include criteria such as [Forms]![cboSelectStudent] if the control is actually on the form, but how would I refer to a value in the form's query that doesn't have a control on the form.

I've been searching for everything I can think to call this but haven't been able to come up with anything.

Thanks.

View Replies


ADVERTISEMENT

Modules & VBA :: Create Unique Reference Number Based On Field Values For Record

Jun 18, 2015

I want Access to automatically generate a reference number for a record based on the values in on two other fields for a given record using a form.

The first field is called Operation Number.

The second is Bag Number.

The reference number needs to be in this format: 19C.3.1

Where 19C is the Operation Number, 3 is the bag number, and 1 is automatically generated. Additionally I need the last number --the automatically generated one--to go back to 1 if with each new bag number.

This is kind of like library catalog numbers. Not sure how to do this.

View 2 Replies View Related

Tables :: Source / Reference Of Different Data Points

Apr 24, 2015

I want the user to be able to see the source/reference of (many of) the different data points in my database, so I need to store sources/references in the database itself. I want to have all references in one single/common table (list of references). Each reference may be the source of many data points, in different columns in a given table, and in different tables. Is this possible, and can it be done in an elegant way?

View 2 Replies View Related

DLookup Returning Circular Reference Warning In Control Source

Oct 15, 2015

I'm working on my first report and am trying to get my textbox, tboJob to show a field value and not the ID. I have tried the following Dlookup in my control source with no luck.

Code:
=DLookUp("[JobName]","Jobs","ID=" & [tboJob])

JobName is the field I want to show from the table Jobs.

View 7 Replies View Related

Help W/ Query- Reference A Specific Record?

Sep 2, 2007

Hey guys-
Been trying to figure this out, but am stuck. Obviously I'm fairly new to Access...

I have a table of properties and the price those properties sold for. Each property is in a specific area of town. I want to take each record and display the Address, Area of town, Price it sold for, and then the AVERAGE PRICE of all the other properties that sold in that same, specific area (not all the other areas of town, but the same area that the property sold for). The result should be displayed as below-

-Address- -Area- -Sold Price- -Avg Sold Price in Area-


And then it will list every property in the database, each with the same calculation all in one grid/table/dataset.

I figured out how to write a query to average all the sold prices in each area- but I don't know how to display that in conjunction with each record. Can someone throw a hint at me here?
Thanks

View 13 Replies View Related

Remove Record Source/Control Source

Sep 19, 2005

I have an unbound form with three tabs. On each tab there is a sub form. Each tab is a search form and each sub is a results returned. I have made everything unbound and set the sub form recordsource and its controls control souce on afterupdate of the main form search criteria. Works fine except for after some use the db decides the sub forms are not unbound and sets the record source and control sources.

I'm trying to do a

Me.PollingPlacesResults.Form.RecordSource = ""
Me!PollingPlacesResults!PollID.ControlSource = ""


but this does not seem to work in actualy removeing the record source and control source.

View 14 Replies View Related

Dynamic Query And Record Source In A Form

Feb 23, 2005

I have Form A that has a combo box and a "Submit" button. When the user clicks on the Submit button it needs to open Form B. Recordsource of this Form B is "Query B"

Item selected on the combo box becomes the criteria for "Query B and Form B needs to be opened based on that criteria.

What is the easiest and fastest way (no dlookups please!) to do this?

If an illustration is possible through an example that will be wonderful.

Thanks in Advance.

View 1 Replies View Related

Reports :: Record Source Of REPORT Other Than Query

Aug 27, 2013

Everytime i make a report in Access, first thing i do is build a query and then use it as a record source. I try the other way, I go to create report design directly and do the drag and drop of fields.

View 2 Replies View Related

Forms :: Using A Query As Record Source Of Subform

Apr 4, 2013

I want to use a query as the record source of a subform. I want to be able to actually write the query out, not refer to a query object, because I want to change the query on the fly using VB.

This subform displays records when I have it opened by itself, but will not return records when it's displayed as a subform. Does writing the query out not work for subforms?

View 9 Replies View Related

Forms :: Record Source Query Is Empty?

Oct 18, 2014

I have a main form with two unbound text boxes that filter a subform with a select query in the record source. The problem is that it only works sometimes.when I copy and paste the SQL into a query instead of the form it works all the time. for example when I open the query and the form side by side with the same SQL the form does not show results but the Query does, and yes I have "requeried" both of them after entering criteria into the unbound text boxes.

Here is the SQL:

SELECT [Quote_ID] & "-" & [Version] AS QuoteIDv, tblQuoteID.Quote_Type,
tblQuoteID.Quoted_By, tblQuoteID.Agency, DLookUp("[Contact]",
"tblContacts","[QuoteID] = '" & [Quote_ID] & "' And [Version] = '" & [Version] & "'") AS contact,
tblQuoteID.Quote_Date, tblQuoteID.FileName, tblQuoteID.FileLocation, tblQuoteID.Amount,
tblQuoteID.Active, tblQuoteID.Quote_ID, tblQuoteID.Version, tblQuoteID.Selected

[Code] .....

View 2 Replies View Related

Forms :: Changing Record Source Of Query Profile

Nov 4, 2013

My form has a Record Source of qry_Profile, it is a query that shows the user the records of the dogs that they currently own. I want to put a button in the form footer to allow the user to show the records of all the dogs that they have ever owned.

So my question is how do I change the record source with vb.

View 1 Replies View Related

Forms :: Filter Form Using A Query Not In Record Source

Aug 20, 2013

I have one form which houses all my product information via the use of a query and subforms where appropriate. I would like to filter it in order to find records missing certain information.

I want to filter the information using a combo box.

The combo box has a user friendly name (Product Dimensions) and the name of a query related to that name (qryfilter_missing_prod_dims - this query is the record source query for the form plus the query that has the missing info, the query is set to return all records that match ie. all records that are missing info).

I want to write a vba code to filter my form based on that query.

And i can't get it to work using the cmd.applyfilter (docmd.applyfilter me.cbo_missing)

I've also tried to use me.recordsource. when i do it filters perfectly, but i can no longer edit any of my data in the form.

How to filter my form using a query that is not in the native form's record source?

View 3 Replies View Related

Form That Is Linked To A Query By Its Record Source - DCount?

Mar 25, 2015

I have a form that is linked to a query by its Record Source.In one of the Text boxes I want to appear the number of rows in the query where Days = 4 so I thought I would try to use DCOUNT as the Control Source for the Text Box. However every expression I try for DCOUNT throws back error? or name?. How to sort my code?

=DCount("[EPISODEUNIQUEKEY]","1-12 Show Records by Date Range","[Days] = '4'")

View 3 Replies View Related

Display Field From A Query On A Form Not In The Forms Record Source

Jul 27, 2005

In short can I display a field on a form that is not in the forms field list without using a sub-form? I am trying to show a value from a query on this form. I tried this in the control source:
[qry_op500_entry_delta]![countofphone model]
I get an error stating that this is not in my field list for the form.
If the answer is No or if needed I can give more information on what I am trying to do.

View 6 Replies View Related

Forms :: Creating New Records On A Form With A Query As Record Source

Mar 29, 2014

In my database I have a form who's record source is a query. That query is based on a table, and have set a criteria on one of the fields.

When I use the form to add a new record I want the value of the field in question to automatically be what I have specified in the query.

Instead, the record is added but without having that value in the field, and when I go back to the form it doesn't display the record because it doesn't meet the criteria specified in the query that the form is based on.

View 2 Replies View Related

Reports :: Record Source From Report Based On Nested Query?

Jul 24, 2015

I have a report that is based on nested (I think thats the phrase) query's.

Complicated Query based on another query (so I can't see a way to get at the the source SQL to change or use elsewhere)

This gives a list of say 20 records I generally want printed. I use the exact same query criteria with a separate update query to add the same to a table.

However I then wanted to just pick one with exact matching ID's I select on a form.

I could not see an easy way to apply this without making another set of nested querys which seems a little excessive

Anyway, an easy way for the printed report to do this is a simple filter added after, works great.

I can't see a way to do the same for an update query.

I was wondering if I could get the record source of this report and add to my table. I have tried with

' Dim db As DAO.Database
' Dim rs As DAO.Recordset
'Set db = CurrentDb
'Set rs = db.OpenRecordset(Me.RecordSource, dbOpenDynaset)
' Set rs = CurrentDb.OpenRecordset(Me.RecordSource)

And dozens of variations over some hours but a variety of errors mainly "too few parameters."

View 3 Replies View Related

Forms :: Assign A Query To The Record-source Of A Form Dynamically?

Apr 27, 2013

Is it possible to assign a query to the recordsource of a form dynamically? I assume the answer is yes. Can this action be done when the form is not open? If yes what is the correct syntax to use when the code is in a normal module as a public sub? I tried many possibilities and could not get it to work.

Code:
Dim ForNm as string
Dim Qry as string
ForNm = "PersonalFm"
Forms(ForNm).Recordsource = Qry
Forms![PersonalFm].Recordsource = Qry
[Forms]![PersonalFm].Form.Recordsource = Qry

View 14 Replies View Related

Reports :: Populating Text Box With Field From Query That Is Not Record Source

Aug 3, 2015

I have a report based on a query. I want to populate 6 Text Boxes with Dates from fields in another query. The date fields I want to add will be headings for columns that represent weeks (they change all the time so can�t be hard figures). The two queries are not really related by any common field. I am not able to get this working because the fields I want are not part of the query that is the Record Source for the Report.

Is there any way that I can do this? Can I change the record source of just the text boxes?

View 5 Replies View Related

Forms :: Record Source Of Query Stopped Allowing Edits

Apr 10, 2013

My form with record source of query has stopped allowing edits.

I have reviewed property setting and do not understand what's going on.

View 2 Replies View Related

Forms :: Opening Form With Inappropriate Record Source Query

Jul 28, 2013

I am setting up a generic form template that will enable me to maintain data in a standardised way. All generic code is stored in a module. There is very little code specific to the table being maintained. Much of the form functionality is determined by data held in supporting tables therefore data driven.

When a form is loaded a commonly named query is created that is used as the Record Source of the form. This query only ever returns one record and uses the value of textbox on the form as criteria in the unique id field.

Despite immediately creating the query in the Open event of the form, Access tries to process the form first and returns an error as the Record Source query applies to another form, the one last opened.

How can I create the query before anything on the form is referenced / processed without creating it before the form is opened?

View 3 Replies View Related

Return Only One Record From Table With Repeating Values In Fields

Nov 7, 2006

I have a table like this


Stuff.
ItemNo Name ImageName
123 Foo 00123.jog
123 Foo 00FOO.jpg
123 FOO FOO123.jpg
456 bar 00456.jog
456 BAR 00BAR.jpg
456 Bar BAR456.jpg
...


I want to do a query to return just one row per unique ItemNo

So the query would return
ItemNo Name ImageName
123 Foo 00123.jog
456 bar 00456.jog

I don't care which one it grabs, the first is as good as the last, as they are essentially different names for the same thing coming from different systems.

I know there's gotta be an easy way to do this, but I've tried things like TOP, DISTINCT, etc and none of them work for me.

View 3 Replies View Related

Reports :: Several Fields In Report - Counting Record Values

May 10, 2014

Suppose we have a report that outlines several fields, one field shows the City. In the report, this week, we see 10 records "New York", 8 records "Houston", 7 records "London", 3 records "Paris" and so on.

Next week's report outlines different cities and different number of records. I need to have in the report footer a "recapitulation" , a field that would say :

New York 10
Houston 8
London 7
Paris 3

Total 28

Next week cities and number of records might not be the same, we may have

Tokyo 12
Singapore 14
New York 6
London 7

Can i make my report in that way that it will count the values without using VBA ? I tried the count values option but it counts the overall report, does not take into consideration the different values.

View 2 Replies View Related

Forms :: Possible To Sort Filter Column Without Subform Record Source Being A Query?

Apr 24, 2014

I have a form that shows multiple rows of linked/child records.The form in question is the "frmFilterNumberTypeView" form. When a particular filter is used (installed on an automobile), I would like to be able to click on the corresponding "Installed 1" button left of the filter number, so that by code, I can reduce the Qty on Hand by One, and insert the corresponding filter ID to the History table, along with the date/time the filter was used.

how to reduce the Qty on Hand, nor how to do the updates to the History table, I'll figure that out myself over the next week or two (hopefully it won't take that long). What I'm trying to figure out here is how I can associate the red "Installed 1" button with the filter to the right of whichever button I press.

how to sort the filter column on this same form. I'm fairly certain that this would be very easy to do if the subform in question was populated by means of a corresponding query, but I'm afraid that if I go that route that I'll spend another 20+ hours trying to figure out how to get the proper filter records to match the filter manufacturer, not to mention having to next figure out how to link the table so that if I modify any particular filter record, that I'll be able to have the associated table update accordingly.

Is it possible to sort the filter column without the subform record source being a query?

View 2 Replies View Related

Count Taking Reference Of Two Field Values

Jun 15, 2006

Can anyone help?

I have few of these columns in my query


Loc Company Pack RoundedNum SumTotal
2 ASDA AA 1
2 ASDA AA 5 6
1 Asda AC 2 2
1 ABC BB 10
1 ABC BB 1 11
2 XYZ AR 1 1



I am trying to achieve "SumTotal" column result. In the above query RoundedNum is an expression achieved from other columns(not shown above) from the same querytable. Now I want to insert this "SumTotal" column which will count for Total RoundedNum as per same type of Packs.

Thus the Total Field should look like the one shown above. Any idea how can i achieve this? :confused:

Thank you in advance.

View 2 Replies View Related

Using Values From A Text Box In Row Source

May 13, 2005

I have a combo box which has a table/query row source type. For the row source, I want to use a query that contains some data from text boxes on the form. I'm currently trying:

SELECT [LAB],[COAT] FROM [University] WHERE [COLOR]=tbColor.value AND [TYPE]=tbType.value;

Although this is a valid query, I don't get any results when used as a row source. No errors, just no results.

Thanks in advance...

View 5 Replies View Related

Creating Reference Number From 3 Fields

Oct 19, 2005

Hi there,

I'm making a document control database where the a unique reference number is automatically generated from 2 tables and updates a 3rd table.

xxxx or yyyy/lookup in 2 table/autonumber

I have been trying to do this is a form but because the control sauce is a calculation 'Text1&Text2&Text3' I am unable to update the 3rd table with the combined reference number.

I have limited knowledge particularly of VBA coding

Any help much appreciated

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved