Modules & VBA :: Parameter Query - Detect If User Has Not Entered A Criteria

Dec 12, 2014

I have a report that is fed by a parameter query. When a command button (Command23) is clicked a parameter box opens and the user enters a subsystem number. A report for that subsystem then opens.

I want to open the report with VBA and show a message if the user has failed to enter a subsystem number in the parameter box and just clicked OK.

The problem is I don't know how to refer to the parameter box and detect if it has been left empty before clicking OK. I first tried to use IsNull in an If statement with Command23.Value, but now realize it is the value in the parameter box I am after, not the "value" of Command23.

How can I change my code to detect if the parameter box has not been filled out?

Private Sub Command23_Click()
If IsNull(Command23.Value) Then
MsgBox "You did not enter a Subsystem", vbOKOnly, "No Criteria Entered"
Else
DoCmd.OpenReport "rptTESTInfoBySubsystem", acViewReport
End If
End Sub

View Replies


ADVERTISEMENT

Queries :: Append Query With User Entered Parameter Values

Sep 17, 2013

I have an append query that currently looks like this URL...This query automatically adds the machine parameters for a product code and lot number into the running condition log. This is so the user does not have to manually go in and tediously select each machine parameter.

The running condition log also has a date field to specify what day and record number the machine parameter's value was recorded on. When I run the query the appended rows look like this. The product and lot are defined by user parameter and there are actually about 36 machine parameters

Code:
Productstockcode LotNo Day Record Parameter ActualCond
PE-500 130816m71 StockTemp
PE-500 130816m71 Zone 1
PE-500 130816m71 Zone 2

My question is: how do I modify the query to automatically add the date and record number in one shot? It needs to be user defined at the time of the query because this data is not stored anywhere else in the database. For each 36 machine parameters the day and record would be the same.

View 3 Replies View Related

Using Form Data In User-Entered Query Search Criteria

Dec 20, 2006

I am attempting my first access database which tracks blood components in our medical facility. When a component is issued to a patient there is a button to push which links to a report that runs a query. The user must enter the unique key for the component at a promt, which ensures the report generated will be for that component only. My question is if there is a way to cpture and use that key automatically when pressing the button. If I need to clarify something, please let me know--I may not have the Access developer lingo down yet...

View 2 Replies View Related

Modules & VBA :: How To Detect If User Has A Touchscreen

Mar 5, 2015

I have a client where a couple of (senior management) users have now got touchscreens attached to their laptops. I already have a facility for users to personalise the look of their forms in terms of colours and fonts (blended with the security options of which controls/forms etc are visible). The system is distributed as accde 2010 runtime.

I added a font size option which enlarges visible controls to cater for it, but it is intended as an occasional change (i.e. user goes into setup and configures the properties). However one user regularly works away without their touchscreen so they have to go in to the properties and reduce the font size and then when back in the office, enlarge it again.

I suggested just configuring everything to the larger font, but the non touchscreen users don't like it since they see less on the screen.

It is not a major hassle for the user but I thought it would be nice if I could detect if a touchscreen was attached and it would automatically adjust the font size.

Some code/api to detect if a touchscreen is attached? What would be really cool is if the code could detect based on the monitor the form is on, but I suspect that is a step too far!

View 5 Replies View Related

Modules & VBA :: User Input Criteria For Union Query?

Aug 20, 2013

I am trying to get my VBA code to dump a query once the user pushes a button. I have the following code to call up the Excel app.

Code:

Option Compare Database
Private Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long

[code]....

The qry_PP_Errors_Union is a Union query. In this query there is a date field. I would like to be able to to use that date field as a parameter. So I have written this VBA to prompt the user for a Begin Date and an End Date.

Code:
Beep
strBegindatemsg = "Enter the beginning date." & vbCrLf & vbLf
strBegindate = InputBox(Prompt:=strBegindatemsg, Title:="Begin Date")
Beep
strEnddatemsg = "Enter the beginning date." & vbCrLf & vbLf
strEnddate = InputBox(Prompt:=strEnddatemsg, Title:="End Date")

Now the part that I am missing is that I am not sure how to make the "strBegindate" and "strEnddate" the criteria for the union query.

The following is the SQL for my union query.

Code:
SELECT LastName, FirstName, Title, TeamName, WorkOrderNumber, DateCompleted, WorkCode, UICError AS Error, "Update and Internal Correspondence" AS Category FROM qry_PP_UIC_Error
UNION
SELECT LastName, FirstName, Title, TeamName, WorkOrderNumber, DateCompleted, WorkCode, BIDError, "Bids" FROM qry_PP_Bid_Error

[Code] ....

Without the criteria, my code works for dumping everything out into Excel. However, dumping all the data results in a 7 mb Excel file that requires manual deletion of the information that is not pertinent.

View 3 Replies View Related

General :: Detect Running From Scheduler With Only A / X Parameter

Sep 16, 2013

Without putting a /CMD parameter value in the command line, is there any way to detect in VBA that the current state of the application is that it is executing from a scheduled task ?

What's happening is that my Outlook email is failing because a Namespace Logon method cannot be invoked when there is no user logged in. I must jump over that statement when running from a scheduler.

View 2 Replies View Related

Queries :: Copy Query Parameter That Is Entered To A Variable

Feb 12, 2014

I am trying to copy the parameter value that is entered to a variable so that it can be used to run other queries without typing it in over and over. Once my form is finished it will run 4 queries, and the current setup is that I would have to retype the parameter each time.

View 9 Replies View Related

Union Query Prompts For Parameters - Returns All Records With Parameter Entered!

May 17, 2006

Hello all,

I realise this issue is a common one and it is usually down to simple typos (I've looked at several similar posts) but none of the advice I've seen has solved my problem. I've designed the following Union Query:

SELECT [Email],[Title],[First_Name],[Last_Name],[Company],[Phone],[Country],[TEST_AND_MEASUR],[REC_AND_PROD],[LOG_AND_TRANSC]
FROM [Region 1]

UNION ALL SELECT [Email],[Title],[First_Name],[Last_Name],[Company],[Phone],[Country],[TEST_AND_MEASUR],[REC_AND_PROD],[LOG_AND_TRANSC]
FROM [Region 2]

UNION ALL SELECT [Email],[Title],[First_Name],[Last_Name],[Company],[Phone],[Country],[TEST_AND_MEASUR],[REC_AND_PROD],[LOG_AND_TRANSC]
FROM [Region 3];


It should be very simple and I've checked it over and over, but when I run the query an Enter Parameter dialog appears prompting me to enter Email.

If I just click OK I get all the records but with the email field blank.

Similarly if I type x@y.com it returns all records but with the email fields all containing x@y.com

Advice would be very much appreciated!! Thank you in advance.

Abi

View 2 Replies View Related

Queries :: Limit The Type Of Data That Can Be Entered In A Query That Has A Like Criteria?

Jan 18, 2014

Is it possible to limit the type of data that can be entered in a query that has a LIKE criteria?

( Like [Enter Data] & "*")

limit to two digits or any number of digits, or limit to numbers only or letters only. .

View 2 Replies View Related

Queries :: Select Query To Pull Records Based On Multiple Strings Entered By A User?

May 1, 2013

Is it possible to run a basic select query to pull records based on multiple strings entered by a user?

I have a query with field criteria - Like '*' & [Type In MMDBID:-] & '*'

This allows the user to input one MMDBID and the records are retrieved from the db.

I can also use the OR statement in the same field criteria "AB123" OR "BC123", and all records based on those values are pulled back.

But I cannot get the user to input multiple values and I tried amending the SQL string based on the OR criteria above

SQL statement (Like) is below :

SELECT tblFund.MMDBID, tblFund.[Investment Name], tblCodesLive.[IOE Code], tblCodesLive.[Uptix Code], tblFund.[Red Payment Deadline]
FROM (tblFund INNER JOIN tblCodesLive ON tblFund.MMDBID = tblCodesLive.MMDBID) INNER JOIN tblContact ON (tblFund.MMDBID = tblContact.MMDBID) AND (tblCodesLive.MMDBID = tblContact.MMDBID)
WHERE (((tblFund.MMDBID) Like '*' & [Type In MMDBID:-] & '*') AND ((tblFund.Editing)=False) AND ((tblFund.Closed_Fund)=False));

View 10 Replies View Related

Modules & VBA :: Open Report Criteria - Enter Parameter Value

Aug 5, 2013

I have one form which have two multiselect listboxes. They work, but every time when I choose id_organizacija from listbox popup enter parameter value comes up.

I am already tried to put id_organizacija in [ ] but that didnt solve problem.

Code:
Set ctl = Me.lstEmployees
For Each varItem In ctl.ItemsSelected
strWhere = strWhere & ctl.ItemData(varItem) & ","
Next varItem
Set ctl = Me.lstOrganizacija

[Code] ....

View 12 Replies View Related

Parameter Query - Allow User To Select All

Oct 10, 2006

I want to be able to have multiple parameter queries, but the user needs to have the option of entering a parameter or not limiting the output at all. How do I let the user choose "all", or what do they type in so that nothing is excluded?

View 14 Replies View Related

Wildcard Query With User Input Parameter Not Working

Jul 12, 2007

I'm using an Excel spreadsheet that is importing external data from an access database in which I've got a field where the name of a person checking materials out is entered. it is currently set up, and I cannot change it, as a free form field. So folks enter information in a variety of ways.

For example, Larry Martin might be entered as "Larry Martin" or "Martin, Larry" or "larry.martin@somewhere.com". I'm trying to run a query that would look in that field for any entry with the string I enter, such as "Martin."

I've tried setting the criteria like this:

Like "*" & [Which Last Name] & "*"

However, when I try and run the query I get a message telling me the system is expecting two parameters.

Does anyone have any idea what I'm doing wrong? I've been banging my head against this for awhile now and am thoroughly stumped! All assistance, as usual, is greatly appreciated!

View 1 Replies View Related

Trouble With Between Criteria In Parameter Query

Oct 8, 2007

In MS Access 97 I have a basic query based on a single table. When I use "Between [Start Date] and [End Date]" as the criteria in a date field it returns incorrect records.

It works correctly on date fields that are not calculated but not on the date field that is calculated. If I type in the actual dates in the criteria (instead of the prompts) it returns the correct records.

Is there a solution to this behaviour? I need the users to be able to input the dates.

Thanks.

P.S. I have tried using the base query as a subquery but I still have the same issue in the second query based on the subquery.

View 5 Replies View Related

Queries :: Using Like Criteria In Parameter Query

Aug 10, 2013

It is possible to create a parameter query in Access that will search for records that match the parameter entered by the user AND contain all other records that have that value plus other text.

For instance you may want Access to return all records that begin with the letter Q.

To do this you need to enter the following expression into the criteria row:

Like [Find records beginning with:] & "*" Or Is Null

The user can enter a Q and the criteria concatenates the wildcard character * to this parameter value, to find all text strings that begin with a Q.

By also using Or Is Null in the criteria the user can enter a blank value into the parameter query to return all records, even if this field is blank.

But how do I search if i want all the records with John anywhere in the field???

View 5 Replies View Related

Modules & VBA :: Detect If A PDF Is Open Or Not

Dec 20, 2014

The code below opens a PDF selected from a form. Whatever document number appears in the textbox (FICNo) on the form is the document that is opened when the command button is clicked.It works but I would like to add a message box to say File not found if the document number in the textbox has no corresponding document in the folder (ScannedFiles).

Code:

Option Explicit
Option Compare Database
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Const SW_SHOWNORMAL As Long = 1
Private Const SW_SHOWMAXIMIZED As Long = 3
Private Sub CmdOpenDoc_Click()
ShellExecute 0, "Open", "C:UsersDavid.BallDesktopScannedFiles" & Me.FICNo & ".pdf", vbNullString, "C:", SW_SHOWNORMAL
End Sub

How can I modify the code to do this?

View 2 Replies View Related

Queries :: User Selected Fields Added To Query Through Parameter

Oct 8, 2014

Is it possible to have the user select which field is added to the query through a parameter? In my query I have a table where each record has a part number and has sales number for each month. When the user runs the query I want them to be able to select which month is returned.

My table basically looks like this:

PartNumber,Jan,Feb,Mar,Apr,May etc.
01PartNumber,15,20,30,25,28 etc.
02PartNumber,12,14,12,16,20 etc

I want the user to enter "Mar" when prompted and return the parts numbers with values from "Mar".

Access 2007

View 10 Replies View Related

Queries :: Subtract 1 From Entered Parameter

Jul 23, 2014

ACCESS 2007

I've got a table in which some records are associated with a number (numeric field): 691, 692, 693 etc. My parameter query asks for the number I'm looking for (parameter) and should return all records associated with that number or with that number minus one.

Something like this:
enter parameter
find records

in which number = parameter
OR
in which number = (parameter - 1)

How can I do that?

View 4 Replies View Related

Passing Criteria To Append Parameter Query Through VBA

Dec 6, 2007

Hello Everybody,

I have an append query that contains a parameter [PTIdent] under the field named PTID. I would like to be able to set the parameter through VBA from a control on a form eg Form!PTID

I use the following code as normal
Private Sub Command19_Click()
On Error GoTo Err_Command19_Click

Dim stDocName As String

stDocName = "apNewPres"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Command19_Click:
Exit Sub

Err_Command19_Click:
MsgBox Err.Description
Resume Exit_Command19_Click

End Sub

Is there a way within this code to do this? I realise I could set the form criteria within the query itself. However I wanted to be able to use this query from multiple forms.

Thanks for any help

View 2 Replies View Related

Queries :: How To Use Criteria Or Parameter In Crosstab Query

Oct 5, 2013

I have a table that has three columns: Nationality, Gender, and Date. First I had the problem of grouping the Nationality column by Gender. That i resolved by creating a crosstab query. Now, I want to put a criteria on Date field so that when the query is run it will ask for the date input and will only show the Nationality and Gender result for specific dates. But when I write something in Criteria field it shows an error saying: "The Microsoft Access database engine does not recognize "[Registration Date]" as a valid field name or expression"..

View 3 Replies View Related

To Display Parameter Query Criteria On Report Even For Nil Results?

Nov 10, 2005

Hi,

Need advise on how to display on my report the criteria that i had specified in the parameter query even if the result is nil.

How can this be done??

Thanks!

View 5 Replies View Related

Queries :: Parameter Value Prompt In Query Using (Like Or Is Null) Criteria

Mar 29, 2015

I had an issue with writing LIKE statements in query criteria yesterday [URL]....

The answer they gave worked perfectly when I only used a single table in the query. But as soon as I did an INNER JOIN with two other tables, now I get parameter value prompts when I open frmSearch, and instead of seeing ALL my records when the controls are left null, I get only the first record in the table.

Here's the SQL of the query, can you point out what I messed up? NOTE that this SQL was 'written' by Access.. as I used the Query builder to set all the 'Like or Is Null' statements, then clicked SQL and sorta formatted the code so I can see what I'm looking at (instead of superthick wall-o-code):

Code:
SELECT tblPeople.name, tblPeople.num
FROM (tblPeople INNER JOIN tblAddresses ON tblPeople.name = tblAddresses.name)
INNER JOIN tblPets ON tblPeople.name = tblPets.name

[code]....

Basically, this is a searchable database of participants in a pet-adoption program, along with the participants' pets history and address history (hence the linked tables as opposed to additional columns in one single table for pets and addresses... there are more than one in some cases). The frmSearch allows a person to run quick searches based upon ANY item in the database, such as name, pets, addresses, pet age, pet type, county of residence, etc. I need to be able to pick ANY field on frmSearch and type a value, and have the qrySearch return records for ANY record's related column wherein any part of it matches what I typed.

The statements as written worked PERFECTLY right up until I added the INNER JOIN. Now I get a set of parameter value prompts for every field on frmSearch that's referenced in the SQL for EACH table I linked to tblPeople, and if I leave everything null and click Search, I want to see EVERY person, but I'm only seeing the very FIRST person in tblPeople.

View 8 Replies View Related

Cannot Run Multi-table Parameter Query With Criteria Specified In Form

Dec 7, 2011

I've created a farm database, with a form (frmSearch) that will allow user to filter data. The form comprises of combo box and list box etc... for the user to input their own criteria. The subform below has a datasource. The data source is based on a query (qContractionSearch) which is basically a parameter query with 3 tables. The problem is, however, that it won't work with 3 tables... but will work if data source comprises just one table.

See the farm database attachment...and go to frmSearch...then go to Contraction tab. (The Cattle tab filter works fine-it only has a single-table datasource).i have a requery macro which runs whenever the user clicks 'search'.

View 3 Replies View Related

Modules & VBA :: Detect No Records In A Table In DO UNTIL Statement

Nov 23, 2013

I have created several queries that in turn create a report. I am trying to write some VBA script to make them execute correctly, however am having trouble with the loop function.

DoCmd.OpenQuery "Qry_SubjectColleaguesByDivision"
Do Until Tbl_ReportSubject.RowCount = 0
DoCmd.OpenQuery "Qry_DataToTrainingReport"
DoCmd.OpenQuery "Qry_DeleteDataToTrainingReport"
Loop
DoCmd.OpenReport "Rpt_TrainingDue28Outstanding"
DoCmd.OpenQuery "Qry_ClearTrainingReport"
Qry_SubjectColleaguesByDivision populates Tbl_ReportSubject with the relevant colleagues. Qry_DataToTrainingReport calculates the report data for the first user in the list and copies to Tbl_TrainingReport, Qry_DeleteDataToTrainingReport deletes their record in Tbl_ReportSubject. Qry_ClearTrainingReport clears Tbl_TrainingReport.

My issue is getting the DO UNTIL statement to work. I am trying to get the loop to finish when there are no records in Tbl_ReportSubject.I know the data structure does not seem robust based on how the data is handled, however this is to do with a) Legacy issues, and b) data importing from other systems.)

View 5 Replies View Related

Clear Previous Data Entered In Parameter Form

Dec 16, 2013

I have a parameter form I used to enter data for a query. I want it to clear any previous data entered when it opens. I have tried the below without success. I also have the fields defaults set as "" and the form set at yes on data entry.

Private Sub Form_Open(Cancel As Integer)
Me.BldgCmb.Value = ""
Me.StateCmb.Value = ""
Me.CityCmb.Value = ""
Me.AddCmb.Value = ""
End Sub

View 3 Replies View Related

Form Based Parameter Query With Multiple Controls Used For One Criteria

Nov 14, 2012

My form-based search mechanism uses controls to set the parameters for the query data source.

I have one field call quantity in stock. I could you a Between and And method to allow the end user to input the stock quantity they want.

HOWEVER, i would love it for the user to first select the Comparison Operator (e.g. > , <, >=, <=) from a combo box and then in an adjacent text box, enter the quantity.

The expression i entered in the query goes something like this.... Forms![frmSearch]![cboRange] & [Forms]![frmSearch]![txtQuantity]

When i try and run this, i get the message "THe expression is too complex to be evaluated".

View 5 Replies View Related







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