Referencing CDbl Value In Stored Query From A New Query

Aug 13, 2007

Hello - am hoping someone can help with the below query.

I have a database with two linked tables. Both of them contain a 10-digit ID number. One table (Table 1) has this ID stored as text; the second (Table 2) as a double.

I need to find records in Table 2 that are not in Table 1. I first created a stored query that converted the Table 1 ID into a double using the function CDbl([ID]). I then created a new query left-joining the stored query on Table 2 against the ID. The query displays the stored query's converted ID.

I run the new query. In the results - if there's a match, the ID successfully appears. But where there's no match - instead of a Null or an empty string, "#Error" appears. Can anyone advise why this is, and how I can work around it?

Thanks!

View Replies


ADVERTISEMENT

Expression Referencing Same Query

Oct 24, 2006

Hello,
I am trying to write a simple query that references calculations in the same query - but I keep getting the "enter parameter value" box.

Basically, I have some columns in a query calculating average and sum values for a column. I would then like to multiply some of those columns together in a new column, using an expression like this: =[AvgOfColumn1]*[SumOfColumn2]. Access doesn't want to do this for me. It seems very simple so I'm sure I'm missing something!

Thanks!

View 3 Replies View Related

SQL Or Stored QUERY

Feb 3, 2008

What are the benefits of each a stored query or sql? I suspect that the stored query would run quicker>

View 1 Replies View Related

Referencing A Field On A Form From A Query

Jul 24, 2005

Hi,

My situation is hard to explain but i will give it a shot. What i have is a db with employees and its being used to track training sessions. These employees are split into 6 teams and those teams are split into 7 teams each.

I have written two queries, first asks the user what team to display. This data is used in the second query. The second query asks for what training item we are searching for. The result of the 2nd query is displayed in a form. Displaying of the information on a form is important. This way the user can verify that the members on this list are the ones he is updating. Now I wrote a third query that works off of the 2nd and updates the datecompleted field with todays date.

Problem is when i post a button on the form to show all these employees complete it referes back to the first query and asks all the filtering questions again.

I would like to know if there is any way to run an update query from a form that has already been filtered. Or if there is a way to reference these records in a new query so as to avoid all the filtereing again

hope i explained it well

Thanks

Ricky

View 7 Replies View Related

Referencing Form Field For Query Between

Mar 10, 2006

Hey All,

I have a question regarding referencing a form using dates between.

Currently I have it setup as:
Between [Start Date] And [End Date]
on the query.

I want to reference a form, which i figured would be like this
Between [Forms]![frmSBReports]![txtStartDate] And [Forms]![frmSBReports]![txtEndDate]

But this doesnt work! :confused: What did I do wrong here? Any help as always is greatly appreciated!

Thanks!
Mateo

View 1 Replies View Related

Queries :: Referencing Other Tables In A Query?

Dec 4, 2014

I have a split database that is working pretty well, but I've been asked to add a functionality to it. I have a table, product1, that contains basic product information. One of the values is a "class", in that if a product was created at a certain time, it fits into a class; the other value in this table that is applicable is the time the product was created.

I have another table, class1, that lists the beginning and end times of the class periods and the class numbers.

So, my users will "ingest" a product, including the time the product was created. I need the query (i think so anyway) to fill in the "class" value in product1, by determining which class it is in by seeing which class beginning and end time it is between in class1 and using the class number found in class1.

View 1 Replies View Related

Queries :: Field Cannot Be Stored In Query

Apr 13, 2014

I am using a predefined query to define the sql statement that will serve as recordsource to a form. Syntax is fine. The predefined query does not have the primary key of the table. The selection in the recordsource is done using this key. So I add this field to the design of the query. I save the query. It says the query is saved. But it is never saved. Run the query again it is not changed.

View 5 Replies View Related

Pass A Parameter When Calling A Stored Query... Without The Prompt.

Jun 29, 2005

I this is a simplifed version a saved query called "qryTest"

PARAMETERS [gUserID] Long;
SELECT [Id],'Complaint' AS IncidentType FROM tblComplaints WHERE tblComplaints.[Id] IN (Select Incident_ID from tblNotification where Dept_ID IN (Select Dept_ID from tblUserDepts Where User_Id = [gUserID] ) AND Incident_Type = 'Complaint');

UNION ALL SELECT [Id],'Fall' AS IncidentType, FROM tblFalls tblFalls.[Id] IN (Select Incident_ID from tblNotification where Dept_ID IN (Select Dept_ID from tblUserDepts Where User_Id = [gUserID] ) AND Incident_Type = 'Fall');


how to i call the result from code or from the query manager and include the parameter so there is no prompt that comes up?


like
Me.ListNew.RowSource = "qryTest " & gUserID &";"
or
Select * from qryTest , 31 - where 31 is the value fed to the parameter


??? does anyone know? I know it can be called in APS like this:

Dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open strConn ' strconn is my connection string
set rsP=createobject("adodb.recordset")
conn.qryTest 31
.....

I can't believe I can't do it from the query string!
Heeeellpppp!

View 3 Replies View Related

Reports :: Stored Procedure Parameter Query - SQL Server

Jan 20, 2015

I have created a stored procedure parameter query and using access created a report that runs the procedure and creates a report based on a parameter entered:

1) I wanted to know if I can specify a default paramter so if I do not input it returns all records?

2) Can I create a stored procedure so it asks for month, for example if I had a createdDate field of data type datetime and wanted to return records for a specific month?

View 1 Replies View Related

Queries :: Update Date Field Stored In Table - Query Not Working

Dec 23, 2013

Why is this update query not working, I'm trying to update a date field stored in a table.

The new date is passed from a txtbox on a form to the update query!!!

SQL code

UPDATE TblDietPlantemp SET TblDietPlantemp.MealDate = [Forms]![FrmSwitchBoard]![txtCusDate];

View 3 Replies View Related

Queries :: Self-Referencing Running Total Used To Calculate Next Total In A Query

Jul 23, 2015

I am trying to create a query that has a self referencing running total based on the values (point totals) of itself (running total of values in the running total column that have already been calculated for all previous records) plus the total of new points being added in the current record, less the total of points being removed in the current record. This running total can never go below 0, if it does, the running total should restart at zero and add in only new points and begin the process again with the next records

I am able to do this in Excel in less than two seconds so I know there has to be a way to port this into a query. I've attached an excel example of what I am exactly trying to do

If it takes multiple queries to complete the required output I am ok with it. In my previous outtakes I have had up to 8 queries but just couldn't seem to do it..

View 9 Replies View Related

Dynamic Query Based On "formulas" Stored In Table

Feb 13, 2008

Hi,

I have a table that looks something like this:


Company Product Sales
1 A 5
1 B 2
1 C 7
2 A 8
2 B 1
2 C 2


I want a query to produce a table showing Products A though D which is
the sum of Products A and B. Result:


Company Product Sales
1 A 5
1 B 2
1 C 7
1 D 7
2 A 8
2 B 1
2 C 2
2 D 9


I have many rows and many summations and the current union query and
supporting queries are pretty messy and not easily changeable. What
I'd like to do is have a third table which would hold the summed
product names and the formula used to get to it (Product D, A + B) and
have a query that can be dynamically based off of that table. Do I
need to use VBA? Does anyone have a better idea? Any help or even a
good search term would be appreciated!


Thanks!
Nathan

View 7 Replies View Related

Referencing "Current" From In Query

Dec 14, 2005

Hi guys, I think that I am being dumb but here goes.

I need the query associated with a Combo Box row-source to filter records based on another field on the form.

I can get this to work just fine if I explicitally include the form name in the query, ie SELECT Client.Client FROM Company INNER JOIN Client ON Company.Company = Client.Company WHERE (((Company.Company)=[forms]![allcalls]![company])); My form name is AllCalls.

However, I will be having many similar forms so do not want to reference the form by name. I am sure that the form can be referenced by me! or something like that but try as I might I cannot get it working.

Am I making sense? and does anyone have a solution?

Cheers

Wayne

View 1 Replies View Related

Referencing

Oct 3, 2007

I know this should be very simple, but I've already tried every possible entry from the site given in the FAQ section of this website (http://www.mvps.org/access/forms/frm0031.htm), but it keeps access keeps asking for a parameter value!!

i have a subform(frmSub2) on a subform(frmSub1) on frmMaster.
I have a combo box (cbo2) on frmSub2 that grabs its value from the value chosen from another combo box (cbo1). Here's what I have tried in the query builder (none work!! why?????):

-[forms]![frmMaster]![frmSub1].[form]![frmSub2].[form]![cbo1]
-[forms]![frmMaster]![frmSub1].[form]![frmSub2].[form].[cbo1]
-[forms]![frmMaster]![frmSub1].[form]![frmSub2]![cbo1]
-[forms]![frmmaster]![frmSub1].[form]![frmSub2].[cbo1]

Please help!!

View 3 Replies View Related

Referencing A Variable

Apr 6, 2008

I want to be able to reference a variable dependant on where I am within a loop. I have myct1, myct2 and myct3 looping then a mycount loop and I want to add a record to a table taking the relevant myct value dependanct on the current mycount value. Any ideas anyone?

Here is my code:

for myct1 = 1 to 3

for myct2 = 1 to 3

for myct3 = 1 to 3

for mycount = 1 to 3

mytable.addnew
myvalue = <if mycount = 1 then myct1 etc>
mytable.update

next mycount

next myct3

next myct2

next myct1

Any help most appreciated.

View 1 Replies View Related

Referencing A ComboBox

Mar 7, 2005

I have code on a subform that is referencing another form that is still open (not the parent form, but the form which's button openned the form that the subform is on). I'm trying to get the value from a combobox that contains the data that will filter the subform in question. See below.
==========================================
Dim strForm As String
Dim strSQL1 As String, strSQL2 As String, strWhere As String
Dim strSelect As String, strFrom As String, strJoin As String

strSelect = "SELECT tblMainData.* "
strFrom = "FROM tblMainData "
strJoin = "INNER JOIN tsubPermissionList ON tblMainData.ResponsibleParty = tsubPermissionList.FullName "
strWhere = "WHERE(((tsubPermissionList.UserID) = [Forms]![frmMainEntry].Form.[cboSelectUser].Column(0)))"
strSQL1 = strSelect & strFrom & strJoin
strSQL2 = strSelect & strFrom & strJoin & strWhere

If IsNull([Forms]![frmMainEntry].Form.[cboSelectUser].Column(0)) Then
' If the combo is Null, use the whole table as the RecordSource.
Me.RecordSource = strSQL1
Else
Me.RecordSource = strSQL2
End If
==========================================

I can't resolve the error:
==========================================
Runtime error '3085':
Undefined function
'[Forms]![frmMainEntry].Form.[cboSelectUser].Column' in expression.
==========================================

Somehow access thinks that the references to the combobox is a function. Can someone help me with this?

Thanks,
PC

View 4 Replies View Related

Referencing A Control

Apr 5, 2005

When clicking on a command button on a form in order to open another form and go to a specified record, i used to use a code similar to the following:

DoCmd.OpenForm "frmName", , , "[FieldName]=" & Me.ControlName

Is it in the same format the above statement if the form to be opened has a tab control ?

Thanks

View 5 Replies View Related

Referencing A Control

Dec 6, 2005

I'm trying to get the value of a textbox on one of my subforms and can't seem to get it properly referenced.

I have a main form Main with a tabcontrol having two pages. One page is Timesheets. Timesheets has a subform called Detail_data.
On the detail_data subform is the text box Time_In that I want to reference. I can get to controls on the timesheet page but not on the detail_data part.

Thanks in advance....

View 1 Replies View Related

Referencing OCX Control

Jul 10, 2007

Hi all

I've distributed a MS 2003 database to another office 1000km away using 2003 as well. The calendar control doesn't seem to be working. I'm assuming that the MSCAL.oxc isn't referenced. Is there a way I can do this programatically without actually having to talk someone through the referencing process over the phone??

Your ideas are appreciated.

View 2 Replies View Related

Referencing A Subform

Oct 28, 2007

When I run the following code in a module -- to change the value of a label in a subform ("Employees Trained List subform" is a subform of "Contractors") I get an error that says it can't find the form (ie. Contractors). Also, if I eliminate "[Contractors]" the error says it can't find "Employees Trained List subform":
Forms![Contractors]![Employees Trained List subform].Form!lblThisYearTrainedDate.Caption = Year(Now()) + 1 & " Trained"
Any ideas on how to fix? Thanks

View 2 Replies View Related

Referencing The Controls On A Subform...

Feb 16, 2007

Hello,

I need some help with a piece of code for a db.

This code checks to see if the last three characters on a ControlSource.Tag property are "Req" and if they are, tests if it's null or = 0 and if it is then it outputs a msg box stating that the control.ControlSource is required. It does it for every control on the main form.

This has worked.

Now, i need to allow for multiple subforms to be located on the main form along with their controls being tested as well. I want to start another loop for each time the conrol on the mainform is a subform.

I have that done so far by using "If TypeOf ctl Is SubForm Then..."

This is the part i need help with. I want to search all of the controls on the subform when it is a subform. I need to search all of the controls on the subform then, and i'm not quite sure of the syntax.

I've tried various somethings like SUBFORMCONTROL.Controls but that hasn't seemed to work...

If someone could help me, that would be wonderful!

View 4 Replies View Related

Referencing Another Table Via Drop Down

Jan 11, 2007

Hi all,

have used the wizard to take values for a table dropdown field from another table

the table has

surname forename and class all of which reside in another table... ive tried to set up the bound columns so when you select a surname from the drop down the other two fileds also referencing that 6able are automatically filled in with their corresponding values.

so if the ref table had

smith john 1m

by selecting smith in the new tables drop down, the forename and class fields automatically select the corresponding values from the ref table..

im sure this is possible but cant get it to work and cant find anything on the web (although this is probably down to not knoing the right search string)

any ideas?

dubs

View 5 Replies View Related

Self-Referencing Table Question

Jul 6, 2007

Having (with much help from many of the experts here) overcome the hurdles of junction tables, subform to subform movements, and the seemingly easy design issues of a form, I have now created a self-referencing table. I humbly return to ask for advice from those experienced with these relationships...

I have been led to this in order to load in to my DB a certain class of documents, linking them relationally to their parent documents, while performing the data input for both into the same form. What I have done and what the problem is are as follows:

I created a new field in my form (formDoc), "LinkedExhibit". In the relationship window, I reloaded the Document table and reestablished all prior relationos, then added a second (alias) table Documents1, linking the primary key of this alias to the LinkedExhibits field.

I have the Linked Exh field set up as a combobox linked to DocTitle from the Documents table ONLY for the purpose of saving keystrokes if a duplicate should arise.

Unfortunately, when I enter a new document and then continue entering data through the LinkedExhibit field, and save by moving on to another subform related to these, the Documents table shows all of what I typed, except it shows the Linked Exhibit saved as DocTitle, and the DocTitle that I had typed is gone...

I really am flying blind but believe the alias table is not linked right, or I am using that concept to do something it cannot do...

I am attaching the DB, in Access2007, if someone could lend an eye to it...
I would appreciate that.

View 14 Replies View Related

Crosstab Referencing A Checkbox

Aug 9, 2007

I'm attempting to build a crosstab query that references fields on a form as criteria for my query. I have no problem referencing a combo box as part of my criteria -- the query likes that fine. However, when I attempt to reference a check box (ex. iif(Forms![CheckBox] = true, "A", "B"), I get the following error:

The Microsoft Jet database engine does not recogine '[Forms]![frmMyForm]![Check100]' as a valid field name or expression.

Anyone have any ideas why I can not reference a checkbox but I can other types of fields in my crosstab query?

Thanks in advance!

View 3 Replies View Related

Referencing A Sub Form Within A Tab Control

Apr 11, 2005

Hey guys,

a quick question.

I have a form called "FormA"
within that form i have a tab control
and one of the pages is called "Page1"
inside that page1 i have a subform named "subform1"
and finally inside subform1 i have a field named "field"

what would be the correct syntax to reference the value of the field???

been messing with this for awhile and am getting a headace, was hoping someone can help

thanks alot

Ricky

View 2 Replies View Related

Referencing A Global Variable

May 18, 2005

I am trying to use a global variable in a dlookup but get an error when i try and run the form

Here is the code:

VUserID is my Global Variable.

Private Sub Form_Open(Cancel As Integer)

Dim UsersName As String

Me.WelcomeBox = UsersName

UsersName = DLookup("[Name]", "tbl Password", "[username] = vUserID")

End Sub

Any Ideas

View 1 Replies View Related







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