Pass A Set Of Current Records In A Form To A Query

Feb 15, 2007

I have a query set up. I need to pass a set of current records ( as I select them in a drop-down menu) in a form to the query as parameters. How would I do it with or without VB? Thanks !

EDIT: Forgot to mention that all combo boxes are bound so they are not customized dialog-boxes which are unbound

View Replies


ADVERTISEMENT

How Do I Pass A Parameter From A Form To A Query?

Sep 11, 2005

Hi

I am struggling with what seems like should be a straightforward task. Unexpectedly however it has become an infuriatingly difficult one (no doubt due to my complete novice status).

I have a very basic d/base (3 tables) that I have been searching using basic SQL queries. I want to create a simple 'search' form that produces the results of my various queries without the need to work in SQL. Enter one or more search criteria, hit ENTER, results presented in datasheet perhaps?

Thought this would have been easy but I've had no luck. Can you please explain how I can pass a parameter from a form to a query?

Many thanks

Stuck21

View 1 Replies View Related

Pass Dates From Form To Report To Query

Jan 29, 2008

I am trying to enter dates in a form that calls a report that invokes a query that uses the dates. It has been a less then satisfying experience. I am getting a Run-Time error 3122. Is it possible and I need to work on syntax or do I need to think of another way? BTW how do I lookup the Run-Time errors?
Thanks for helping an old guy learn new tricks.
Jim

View 5 Replies View Related

Pass Multiple Values On Form To Query

Jun 28, 2005

Hi there. What I'm attempting to do is pass multiple values from a multiple selection list box as criteria for an Append Query. Is there any way to do this? The DB keeps track of Real Estate boards and the forms that they use, I would like to be able to select all the boards in a given state/province, but have the ability to deselect some within that province if I don't need them in the query (this is the criteria i'm trying to pass). I don't need to use a list box, any control that would allow me to pass multiple values would be great. Anyone able to help? Thanks very much.

View 1 Replies View Related

Pass Variable To Form And Decide Which Query

Aug 15, 2006

Is it possible to pass a variable to a form when a checkbox is clicked?
I have 8 tabs, each of which has a checkbox.
When a checkbox is clicked, I would like it to display 1 form but that form should display different data each time by either running a SQL query with specific variables passed to it or by running a different SQL query.

?

View 1 Replies View Related

Queries :: Pass A Formula Form A Query To Excel

Apr 5, 2013

Access 2003
Excel 2003

I have a routine that exports the results of a query to an Excel file. Is it possible to input the formula into the query so that the Excel values calculate?

This is the formula I am trying to pass to the "AZ" column of the Data tab

Code:
MyCalc::"IF(T2="","0",TODAY()-T2)"

View 1 Replies View Related

Forms :: Search Bar Is Only Looking At Current Form And Not At Records

Jan 9, 2014

I have several forms in a navigation form. On all the forms, the little search bar at the bottom shows # of 103 records. On my navigation form it shows 1 of 1 and won't allow me to search.It would seem that the search bar is only looking at the current form and not at the records.

View 1 Replies View Related

Queries :: Pass TempVar To Query That Is Selected From Previously Opened Form

May 23, 2013

I'm trying to create a query that supplies a form with data. I want to pass a TempVar to the query that is selected a from previously opened form.The TempVar is setting correctly and I can see if this if I place a textbox (NewCID) on the form showing the TempVar. The problem I have is displaying on the records according to that TempVar. If I set the query manually, i.e. "|Test|" then records are displayed but if I use the TempVar, which also displays |Test| then no records are brought back.

think it's something do with the vertical bar and that fact the field I'm searching on is a memo field, both of which I've no control over. I also have to use the Like statement because of this.Here's the query that works...

SELECT *
FROM dbo_ASSETS
WHERE ASSET_CID Like "|Test|"

and the one that I want to use, that doesn't...

SELECT *
FROM dbo_ASSETS
WHERE ASSET_CID Like [TempVars]![tmpvarCID]

I've even tried referring to the textbox instead of the TempVar, i.e.

SELECT *
FROM dbo_ASSETS
WHERE ASSET_CID Like [Forms]![AssetsCID]![NewCID]

but that doesn't work either.

View 2 Replies View Related

Forms :: Refresh Current Form With Filtered Records

Sep 13, 2013

I have a form that displays records from a table.

When opened it displays all records (no selection yet).

I put would like to put 2 buttons to filter records (Male/Female).

I'm thinking of 2 possible options:

1-on click run a script that will close current form, then reopen it with selection criteria
2-directly apply a filter on the current form that would automatically refresh itself with the right records

Another (heavy, inelegant?) solution would be to create duplicates of this form. they would be loaded from separate queries that select the right records in either choice.

View 4 Replies View Related

Forms :: Create Report From Only Records On Current Form

Oct 23, 2013

I have a continuous form based on a 'start date' - 'end date' query. I would like to be able to select certain records from this form to print.

I have added a 'print' field and have created a new query including this parameter which a report can be based on but when i run this report I am, of course, asked for the original 'start date' and 'end date' again.

Is there any way of linking the command button to only the records on the current form?

View 1 Replies View Related

Forms :: Carry Current Value Of A Control To New Records On A Form With Tabs

Nov 10, 2014

I have created a new form with a few tabs, I need to let the value's of the last record be carry to a new record, but it must only show when I press the first letter on the new record, I did rerad about this, but only find it for normal forms. Did try to get it to work, but it dows not work on tabs form

View 2 Replies View Related

Queries :: Selecting Most Current Record For Item That Has Multiple Records In A Query

Oct 31, 2014

I have a query pulling data from two other queries (qry_Reports and qry_Surveys). Clients may have more than one ReportID, but only one ClientID. I need to query for only the most current ReportID (which is the larger value) for each client to find the surveys for the most recent report. How can I query for only the most recent report for each client based on the highest value of the ReportID per ClientID?

View 11 Replies View Related

Modules & VBA :: Query Records By Current Date Then Email Results On Button Click

Feb 26, 2014

I am trying to query my records by the current records selected date then send the results in the body of an email on click. I believe I am close but I think there is a problem with the date format because I am getting 3421 Data type conversion error. Here is what I have:

Code:

Private Sub eMail_Click()
On Error GoTo EH
Dim dbExceptions As Database
Dim rstExceptions As Recordset
Dim dbDate As Database
Dim rstDate As Recordset

[code]...

View 3 Replies View Related

Forms :: Goto Form With Current User And Current Date

Aug 27, 2013

What I really need is for when the form opens, it looks at todays date, then matches current user and then goes to that record for today, if no current user there, then will goto new record..

i know, sounds complicated, and probably is really easy, but my heads not with it today, as about to get drunk as its my 40th, and got people ringing and texting and still trying to get this done....

I've included a copy of this database, named Timecards..

View 1 Replies View Related

Procedure Works Great First Pass, But Not The Second Pass

Jul 15, 2005

Good afternoon, I have a form with a subform and in the first txtbox of the subform in the GotFocus event I have a little procedure which checks the txtboxs on the parent to make sure that there is data in all four of the txtboxes. This works great the first time and it pops up a msgbox and it even setsfocus on the txtbox with no data in it, but if I tab into the subform a second time and there still is no data in one of the txtboxs on the parent form, nothing happens, no message and no setting focus on the txtbox with no data in it. Does anyone know of a way to get this procedure to re-set everytime a user tries to enter the subform? Thank you in advance to anyone offering and ideas and suggestions.

View 8 Replies View Related

Query Help Needed Using Values From Current Form

Mar 13, 2007

Hi i am having problem creating a query that will pull the price of a property into the price field on to a booking order form depending on the values of the start date and property number enter onto the same form.
i have a two tables property price and booking order.

Fields in the property price are property price no, property no, start date, end date and price.

Fields in the booking order table are booking no, property no, start date, end date, cost, no of days, total cost.

When in the booking order form i need the query to get the price from the property price table matching on the property no i've selected on the booking order form and also the start date i've entered on the booking order form needs to be between the start and end date fields in the property price table.

This is the query i have created but doesn't work
SELECT [Property Price].Price
FROM [booking order] INNER JOIN [Property Price] ON [booking order].[Property No] = [Property Price].[Property No]
WHERE ((([forms]![booking order subform]![start date]) Between [property price].[start date] And [property price].[end date]) AND (([Property Price].[Property No])=[forms]![booking order subform]![property no]));

Thanks for your help

View 2 Replies View Related

How Can The Field On The Current Form Be Used As A Parameter For A Query?

Dec 21, 2007

Hi-

I have an Access DB with several different forms all relating to one master table.

Each record in the table can be resolved=yes or resolved=no.

Right now each user must click the resolved box to resolve the entry and then enter the date.

I have created a button that will run the update query below.

UPDATE [TBL Master] SET [TBL Master].[Resolved] = Yes, [TBL Master].[Date Completed] = Now()
WHERE ((([TBL Master].[Primary key])=[forms]![frm name]![primary key]))
WITH OWNERACCESS OPTION;

The query allows me to update the record on that form efficiently. However, I do not want to create one query for each form (30 plus) for this.

Is there a way to use the form that was used when the button was clicked without naming the form specifically?

View 4 Replies View Related

Query Using Field From Current Open Form Using VBA Function

Oct 23, 2005

I am trying to resolve an issue of being able to use a query from many different forms where the query is dependent on the date selected in the current open form. Right now it calls the function getDate() which works fine. Unfortunatly the function is called before the form is fully loaded and the control I want to pass has no value/doesn't exist yet and I get a
"Runtime error 13 Type-Mismatch"

Here is the function code:

Function getDate() As String

If fIsLoaded("F_SupplierData") Then
getDate = Form_F_SupplierData.txtDate
Else
getDate = "01/01/1901"
End If

End Function

Function fIsLoaded(ByVal strFormName As String) As Integer
'Returns a 0 if form is not open or a -1 if Open
If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> 0 Then
If Forms(strFormName).CurrentView <> 0 Then
fIsLoaded = True
End If
End If
End Function


Is there a way to detect the state of the text field itself (if it is open, closed, dirty)? Or if anyone has a better way to tie a query to multiple forms?

View 5 Replies View Related

Using Expressions And Current ID Of A Form To Create A Query And Print A Report

Mar 6, 2013

I want to have Access run a query, open a report, and print the report based on the ID number of the form that I have open. Is this possible?

The situation would be, I have a form that uses the the primary key as a record number. After I enter the data into the form, with the form open I want to add a button to open and print a report of the current record number.

View 3 Replies View Related

General :: Modal Form - Open Concrete Form And Pass Value To Control

Jun 21, 2013

I have modal form - frmZlecenia

I would like to copy one control, then close this form, open concrete form and pass value to control.

My code is

Private Sub Menu_Click()
DoCmd.OpenForm "frmZleceniaMarzenaNawigacjaPD"
Forms!frmZleceniaMarzenaNawigacjaPD.Form!Imie = Me.Imie
Forms!frmZleceniaMarzenaNawigacjaPD.Form!Imie.SetFocus
DoCmd.Close acForm, Me.name
End Sub

The problem is, still opens the previous form, not form "frmZlecenia"

e.g If I open form x then from this form I open my modal form "frmZlecenia" and then I will click "menu" button - now form "x" is open :/, but should be "frmZleceniaMarzenaNawigacjaPD"

There is some way to open concrete form from modal form?

View 1 Replies View Related

How To Pass A Value From One Form To Another

Nov 26, 2013

So I have 2 forms, an Edit Lot Form, and an Add Run Form. Each lot will contain several runs. What I want to do is be able to add a run associated with the specific lot by pressing a button "Add Run" in the lower right corner of the edit lot form (see attached images). So the information for the lot will carry over to the run form and autofill the fields pertaining to the Lot in that form.

View 2 Replies View Related

Pass-Through Query Help

Jul 13, 2007

I'm trying to create a PTQ and just cant seem to find the source table.

The name of the source table is PRM1_ORG_MTRX3_N

If I write my query like this, I get an error code that states username.PRM1_ORG_MTRX3_N is an undefined name. It adds my userid to the beginning of the table name.

SELECT
T128.AS_OF_DATE,
T128.LEVEL8,
T128.LEVEL8_ORG_NAME,
T128.LEVEL9,
T128.LEVEL9_ORG_NAME

FROM
PRM1_ORG_MTRX3_N as T128

WHERE
T128.AS_OF_DATE like '1/1/2007'

Then I rewrote the query like this, and I got and error code that said PRM1.ORG_MTRX3_N is an undefined name. Does anyone know what else I can try here to get this query going? Thanks


SELECT
T128.AS_OF_DATE,
T128.LEVEL8,
T128.LEVEL8_ORG_NAME,
T128.LEVEL9,
T128.LEVEL9_ORG_NAME

FROM
PRM1.ORG_MTRX3_N as T128

WHERE
T128.AS_OF_DATE like '1/1/2007'

View 2 Replies View Related

Pass Through Query

Jun 30, 2006

Can you do a pass through Query to a pivot table when your query has parameters? I'm reading like you can't, but nothing has been said concretely yet. When I do it, it gives me an error "Trouble Obtaining Data" when I try and set the layout.

View 1 Replies View Related

SQL Pass Through Form Variables

Feb 3, 2008

I know this is probably obvious but how do I pass through form variables to sql server I currently have:

exec QStudent @_param_cmbYear="0708", @_param_SelID="S", @_param_SelForename="d", @_param_SelSurname="S"

this executes correctly SelID being a student ID or partial ID also allowing for surname forename partial search. I thought it would just be:

exec QStudent @_param_cmbYear=[Forms]![Attendance and Lateness Main]![cmbYear], @_param_SelID="S", @_param_SelForename="d", @_param_SelSurname="S"


to switch acad year to a form variable and repeat for the others but it errors on trying to save the pass through. Thanks for the help.

View 1 Replies View Related

Pass Values From One Form To Another

Jan 21, 2015

I have a database that I am creating to enter risks and controls in for business auditing. I am stuck with a problem related to passing a value from one form to another. The general idea behind the database is this: A business enters its risks into a risk form and later enters its controls in the controls form. These are separate forms because the risk and controls may be entered at different times by different auditors. An example of what this looks like is this:

Risk Real estate owned by the company may be overvalued on the companys balance sheet.

Control Once every two years, the company obtains an independent appraisal of the propertys value.

A risk may have more than one control mapped (assigned) to it. A control may be assigned to more than one risk.Now that we know what the end result looks like, here is my problem.

Currently, I use a form to display the risk. This form has a subform on it which displays the control. I use a combo box on the subform to choose the controls ID reference number. When chosen, the control appears in the subform. This form then populates a join table which now contains the foreign key identifiers of both the risk and the control or controls. The problem is that the controls are wordy and stored in memo fields, so the user has to choose the controls identifier in the combo box, which is usually not know to the user. So, I have a button on the form the user can select and a report of all controls pops up so the user can scroll through and find the desired control and get its reference ID. They then close the pop up report and choose the reference ID in the combo box.

What I would like to do is to have the pop-up report appear as a form and each control had a checkbox next to it. Then the user could just check the box for the control they wanted. No more selecting reference IDs from the combo box.

View 1 Replies View Related

How To Pass Parameter To Query?

Dec 6, 2007

Hi

I have created a simple query that is used as the record source of one of my forms. I want to pass the query a different criterion each time the form is opened.

Any suggestion/example on who to do that will be very much appreciated.

Thanks,
B

View 4 Replies View Related







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