Modules & VBA :: Passing Values (From Two Column Listbox) To Saved Query

Oct 3, 2013

How can I pass two (2) values to a saved query ? These values are in a form that has a listbox with two (2) columns. The name of the form is 'Previous Evaluation Form'. I'm able to retrieve the values from both columns of the listbox in the form and I've already created the query. Both are working fine, but can figure out how to pass the query's criteria to select records for 'Name' and 'Date' columns of the query. Below is what I had in the 'Criteria:' of the query. What wrong with the code that is placed in the query's 'Criteria:' ?

Forms![Previous Evaluation Form]![Individuals].Column(0)
Forms![Previous Evaluation Form]![Individuals].Column(1)

View Replies


ADVERTISEMENT

Modules & VBA :: How To Set Parameter Values For Saved Query

Jun 26, 2013

I am using MS Access 2010 to export data into MS Excel 2010 spreadsheets.

I am just wondering: Is there a way to set the Parameter value for the query via VBA?

For example: There are 10 regional managers. When I click a button on a form, 10 sets of data per manager are going to be exported into Excel spreadsheets.

I have created a saved query named [For exporting] with a parameter [Manager Name] for the field [Master Table].[Manager].

The VBA for the button has 2 subs:
1) Sub 1 for the loop for 10 managers

Code:
...
strQuery = "SELECT DISTINCT [Master Table].[Manager] FROM [Master Table] WHERE ((([Master Table].[Manager]) Is Not Null));"
Set rstStores = CurrentDb.OpenRecordset(strQuery)

[Code].....

View 10 Replies View Related

Help Passing A Text Box String To A Saved Query

Sep 21, 2005

I have a multi-select list box that runs a "For intCounter" and builds a sting into a text box. That works fine the text box will populate as designed <"Closed" OR "On-Going">.

(I know that I should be dynamically creating the query in the first place ... normally I would ... but this is a quick fix that I want to get it into an existing application, while the redesign requirements are being written.)

Now I want to pass that string to a pre-existing query, but I'm not sure what to write in the criteria section.

I've tried...
Like "*" & [Forms]![ViewReports]![TextPickList] & "*"
IIf([Forms]![ViewReports]![TextPickList]="","",[Forms]![ViewReports]![TextPickList])

and just plain old ...
[Forms]![ViewReports]![TextPickList]

but my query is coming up blank. What do I need to write into the criteria section of this saved query?

thanks in advance!

View 2 Replies View Related

Queries :: Passing Column Name Parameter To Query

Aug 29, 2013

SUMMARY:
In Access 2007, can I pass a Column Name as a parameter from a Combo Box in a form?

DETAILS:
I would like to use a String value from a Combo Box as a parameter in a Inner Join query:
...
WHERE (((AAA.HSC) Like Forms!My_Form!My_TextBox)
AND((CCC.Forms!My_Form!My_ComboBox)="X"))

Where "CCC is a Table from my Join Query

I'm able to run the code above without generating any errors. However, instead of the query accepting the value from the Combo Box, it opens a pop up asking for the value of "CCC.Forms!My_Form!My_ComboBox", not once, but twice! After it finally runs, the result set is empty when it should not be. I also find it strange that it is asking for the combo box value with the Table name appended to the front.

View 4 Replies View Related

Forms :: Passing Listbox Rowsource To Another Form Listbox

Dec 14, 2014

Using a popup form

1. On my main form, I have a listbox, I would like to edit the values of the listbox.

To do this, I have a popup form with 2 listboxes, one to have the values of the listbox on the main form, and the other listbox with option values for the 1st

1) how to i pass the rowsource sql of the listbox on the main form to the listbox on the popup form

2) how on closing the popup form, do i update the rowsource sql listbox on the main form from the changed value of the popup form listbox rowsource sql

View 3 Replies View Related

Forms :: Hide Unchecked Values In A Listbox - Create Hyperlink On Listbox Values?

Jan 20, 2014

Firstly, is it possible to hide unchecked values in a listbox? I have a user with several roles and I want to only show the ticked roles in the listbox.

Secondly, can you create a hyperlink on listbox values? i.e, if I click on "Manager" in the roles listbox, it follows that to another form and opens the record about managers?

View 10 Replies View Related

Modules & VBA :: Get Other Than Bound Column From Multi-select Listbox

Feb 6, 2015

I have two listboxes. One for Activities and the other for Organizations.

I set the Org listbox to be multi-select so I could run a loop on that listbox to join multiple Orgs to a single Activity. That part works well.

To do so, I am using the bound column (which is the pkey value) from the multi select listbox, and on the single select listbox I'm using the ListboxName.value to gather the pkey for the "1" side of this 1:Many series of inserts.

Now... I want to use one of the other-than-bound-column value from the multi-select listbox, but I don't know how. When setting a value I only know of the use of :

Code:
ListBoxOrganizations.ItemData(varItem)

and I don't know how to do the equivalent of

Code:
ListBoxOrganizations.ItemData(varItem's column(2).value)

yes, I just made that up, but I hope you get the point. Meaning, as the loop cruises the ItemsSelected on the multiselect I'd like to use other than the bound column when setting variables.

I've tried using the column property to then cruise to the proper record in the listbox, e.g. :

[code]
txtCollaborationDesc = "Collaborate " & ListBoxOrganizations.Column(2, varItem) & " with " & listboxActivities.Column(2)
[code]

But this seems to return the column(2) value of the first record loaded into the list box, as if the varItem piece is being ignored. I believe the loop is working properly, as when the inserts are happening correctly with the bound column of the multi-select list is correctly present as an Fkey in the resulting child records.

I just can't get any other column's value for some reason.

MS Access 2010 and this is an accdb.

View 3 Replies View Related

Passing Multiple Values To A Query

Sep 16, 2005

Ok, i have a form in wich i want to set the parameters to a query.
On the search button it will open another form to display the data.
i used this code stLinkCriteria = "[ID]=" & Me![id] And "[status]=" & "'" & Me![sta] & "'
the 1st value for status is "active"
it returns a msgbox asking the value of the parameter and a field to input the data.

I can't understant whats wrong....

View 4 Replies View Related

Passing Values From Form To Query?

May 2, 2013

I have a form - RunQuery And I have a query - Q2.

The form has text boxes for dates txtStart2, txtEnd2.

On button click I have a macro.

Query Name Q2

view Datasheet
datamode edit

The query will open

The query has a field Assigned which is Date/Time

In my query design view I have this as the criteria:

>[Forms]![RunQuery]![txtStart2] Or <[Forms]![RunQuery]![txtEnd2]

I also have filter on load set to yes.

However the filter does not seem to work.what is missing or wrong?

View 6 Replies View Related

Passing Multi Parameter Values To A Query

Aug 14, 2005

I have a query set up which needs to have different criteria at run time depending on values selected by the user. If no option is specified, I need to pick up all records with 'Nulls' in them else, if date is specified by user, I need to pick up all records with date > than specified date. The query is able to pick up the date value from an unbound text box in the form. I used the same field in the form and populated "Is Null" in the field and it does not work. How do I pass this as a paramater to the query from the form?
Is there a way around without setting up 2 sets of queries and reports?

Thanks,Priya :mad: :confused:

View 5 Replies View Related

Passing Values On Form To Union Query

Oct 20, 2005

I'm currently working on a database which provides copier and postage activity in my department, using Access. I'm trying to debug a query which is called by a form that accepts input for a particular month and year. Whenever the OK button is clicked, it gives a message "The Microsoft Jet database engine does not recognize 'Combination Query' as a valid field name or expression."

"Combination Query" is a union query which calls two intermediate queries, each of which in turn calls a base query. Only one, the query responsible for gathering copier activity, is a crosstab query.

The problem I believe lies in either or both of the base queries only when the form is used. When I use a regular parameter query, I receive no error messages.

Here is the SQL code I used for each:

Query 1: Copier Activity
Code:PARAMETERS [Forms]![frmObtainMonthlyInfo]![cmbMonth] Long, [Forms]![frmObtainMonthlyInfo]![cmbYear] Long;TRANSFORM Sum([big table].Copies) AS SumOfCopiesSELECT [big table].[Copy Code], [User codes].Alias, Sum([big table].Copies) AS [Total Of Copies]FROM [User codes] INNER JOIN [big table] ON [User codes].[Copy Code] = [big table].[Copy Code]WHERE (((DatePart("m",[big table].[Time]))=[Forms]![frmObtainMonthlyInfo]![cmbMonth]) AND ((DatePart("yyyy",[big table].[Time]))=[Forms]![frmObtainMonthlyInfo]![cmbYear]))GROUP BY [big table].[Copy Code], [User codes].AliasPIVOT [big table].[Copier Location];

Query 2: Postage Activity
Code:PARAMETERS [Forms]![frmObtainMonthlyInfo]![cmbMonth] Long, [Forms]![frmObtainMonthlyInfo]![cmbYear] Long;SELECT [big Postage Activity].sAcctNum AS Account, Sum(Nz(cBaseRate*lNumPieces,0)+Nz((cRegisteredFee+ cCertifiedFee+cReturnRecFee+cReturnRecMerchFee+cSp ecDeliveryFee+cSpecHandlingFee+cRestrictedDelvFee+ cCallTagFee+cPODFee+cHazMatFee+cSatDeliveryFee+cAO DFee+cCourierPickupFee+cOversizeFee+cShipNotificat ionFee+cDelvConfirmFee+cSignatureConfirmFee+cPALFe e+cResidualShapeSurcharge)*lNumPieces,0)) AS TotalFROM [big Postage Activity]WHERE (((DatePart("m",[big Postage Activity].[sSysDate]))=[Forms]![frmObtainMonthlyInfo]![cmbMonth]) AND ((DatePart("yyyy",[big Postage Activity].[sSysDate]))=[Forms]![frmObtainMonthlyInfo]![cmbYear]))GROUP BY [big Postage Activity].sAcctNum;

I edited this to make it look similar to a recommendation posted on another forum, but sometimes I would get the message "The Microsoft Jet database engine does not recognize '[Forms]![frmObtainMonthlyInfo]![cmbMonth]' as a valid field name or expression."

I also included PARAMETERS [Forms]![frmObtainMonthlyInfo]![cmbMonth] Long, [Forms]![frmObtainMonthlyInfo]![cmbYear] Long; as the first line in the intermediate tables, but I still receive the same error message.

I'm wondering if there was something I overlooked or if there was a way around this. I can post the other queries if you need those. Many thanks in advance for your help.

View 3 Replies View Related

General :: Passing A Field Value To Insert Query With Values

Jun 2, 2014

I have a button on a subform that becomes visible if there is no records in the source of the subform. When clicked I want to run a query that will insert a record on to the source of the subform. There is one field in the query that I need to get from the parent form.The first part works OK - the button is visible when the source file to the subform for this main form record, is empty.

If I run the query against the source file it inserts the new record after it has asked for the value of the variable field.My problem is that when I try to run the query when the button is clicked It can't find form![ClientFileFrm]![ClientId]..This is my code on the subform

Private Sub Form_Load()
If Me.RecordSource <> "" Then
If Me.Recordset.RecordCount = 0 Then
Me.AddSettingsButton.Visible = True

[code]...

The ClientFileFrm is the main form.I can't seem to reference the clientId variable back to the main form.

View 1 Replies View Related

Forms :: Listbox Data Cannot Be Saved In Table

Aug 11, 2014

I have a trouble to save data from Listbox to table. I can select mutiple data from Listbox, but the data cannot be saved on the table.

Here is the detail infor:

FORM name: Attendance
FORM record source: TBL_Attendance
Listbox Name: ARR_Result
table for Listbox to use: TBL_ARR

I want to these multiple records which come from Listbox (data on the TBL_ARR table)to be saved in table TBL_Attendance.

View 8 Replies View Related

Only First Column Of Listbox For Query

May 19, 2006

I'm still a little new to this, so please bear with me. I've searched to no avail for what I am looking for, so if there is an existing thread and you would rather point me in it's direction as opposed to answering my question, that would be fine.

I want one of the parameters of my delete query to be only the first column of my "ProdList" listbox, but don't know how to specify this. This is what my query looks like so far... Can someone tell me how do i need to change it?

DELETE ProductionLog.Username, ProductionLog.Date, ProductionLog.OrderNumber
FROM ProductionLog
WHERE (((ProductionLog.Username)=fOSUserName()) AND ((ProductionLog.Date)=[Forms]![Production]![TheDate]) AND ((ProductionLog.OrderNumber)=[Forms]![Production]![ProdList]));

View 2 Replies View Related

Forms :: Passing Operator Values To Criteria Field In Query

Mar 11, 2014

I have a query which contains figures. i have a search form based on this query and need to search using comparison operators such as <10000 or >500.

Is there a way to pass these value to criteria field in query ?

View 14 Replies View Related

Tricky - Highlight Listbox Pre-Loaded From Master Highlighted From Saved

Feb 13, 2006

Hello Everyone :D :

I have a reporting interface providing users with a multitude of reporting options and capabilities. One aspect involves utilizing the ability to allow users to save their settings on the interface due to the number of options provided. One of the aspects revolves around working with listboxes.

Each listbox is pre-loaded every time with a list of items from a master table pertaining to the listbox. The user selects their desired choices, saves*, etc...Once loading a setting, I'm looking to have the listbox pre-loaded (easy) but then auto highlighting the items selected or rather pulled from the user settings table (each listbox has own table for user saving of options). So, if a user selects items Alpha, Beta, Delta, and Falcon from a list of 100 choices, then those 4 items would be saved under that user setting, within the code table (user specific). When they load the setting back onto the user interface, it should pull the 100 choices and auto highlight the 4 items. Hopefully I've explained that properly.

*A user is able to save, save as, load settings, unload settings, etc...from the reporting interface. When a user saves settings, these settings are saved within the user settings tables. Each table varies depending on the nature of the values within the reporting interface. Listboxes have their own tables connected to the primary settings table.


Any ideas anyone? :rolleyes: :D

View 4 Replies View Related

Modules & VBA :: Combobox / Listbox Change Event Populate Values In It

Nov 21, 2013

I am trying to write a code that will execute at the change even of the combobox/Listbox and when a character is typed in it then all the data from "DocumentType" field whose first character matches with the first character typed in Combo/Listbox will be stored in it.

The following code doesn't work:

Private Sub ComboBox4_Change()
Dim strText, strFind As String
strText = Me.ComboBox4.Text
If Len(Trim(strText)) > 0 Then
strFind = "BarcodeRef like '" & strText & "*'"
End If

[Code] .....

View 1 Replies View Related

Modules & VBA :: Passing Values Of Selected Items From First Form Until Third Form

Aug 12, 2013

I would like passing values from first form until third form.

In the first form I have a list box after selecting items (For each selected item in first form I have 4 values) and pressing button (or right click of mouse) the second form will be open, then in the second form I have 2 option (inserting, deleting), when I select inserting or deleting in the second form, third form will be open, in the third form there is a "OK" button, when I press that, passed values from first form will be used for inserting or deleting records to the table.

View 4 Replies View Related

Modules & VBA :: Fill In Values In Column After Selecting A Value From Combo Box

Jun 4, 2015

I have a form that is a datasheet. it contains multiple records. One of the fields in that datasheet is a combo box. I would like to make it so when I select a value from the combo box it changes all the values of the other records in that column/field to what was chosen from that combo box. is that possible?

View 4 Replies View Related

Need Help I Cant Work Out Were Values Are Saved To??

Mar 20, 2008

Hi there.
I downloaded a demo database (attached, Expiry 200 ) witch allows me to distribute my databases in demo mode with the option of registering a full copy.
this works a treat so far. :)
but now i want to modify the code but i cant work out were the values in the frmsetexpiry are saved to (the registry maybe?) IE: max number of times, company name etc.

any help will be much appreciated with this
thanks
rob

View 12 Replies View Related

Modules & VBA :: Passing All Values From Subform To Another Subform

May 26, 2015

I know how to use openargs to pass values between forms but im not sure how to go about passing all the values from one subform to another.

To be specific I have an order form (frmCustomerOrders) that has fields like CustomerName, EmployeeName, OrderDate and so forth, the subform (frmCustomerOrdersSubform) contains information on the Products the customer is ordering which usually has multiple records with fields like ProductName, PartNumber, Quantity and ItemNumber. I want to pass the values from the CustomerOrdersSubform form to another subform (TransferSubform) My initial thought was to use something like the openform command through openargs but im not sure if that will work or if there is another method I should use.

View 9 Replies View Related

Modules & VBA :: Wildcard Search Of Combobox - Lookup Values In Table Column

Nov 19, 2014

I have a form which has a combobox called Task_Ref which looks up values in a table column.

I would like to be able to set the tickbox value of tickbox called P1 to True if the combobox contains the word "test", each entry on the combobox selection may vary such as:-

Test number 1
Yesterdays Test

As long as the word "Test" appears I would like the above to happen?

I was thinking of something along the lines of:-

If InStr(Task_Ref.Value, "Test") > 0 Then
P1.Value = True
Else
P1.Value = False
End If
End Sub

But this hasn't worked

View 4 Replies View Related

Multiselect Listbox Passing To A Field

Jan 26, 2005

I'm trying to create a database where a single "Classification" field is populated by selections made in a multiselect listbox and I can't figure out how to do this. Any help people can provide?

Table 1:
Name_ID <pk>
Name
Classification

Table 2:
Classification_ID <pk>
Classification

What I want to happen is click on a button next to the Classification field (text) and a popup form with a multi-select list loads (this part is easy, of course). The user can select as many classifications as they want, click the ok button and each item selected then goes back to the first form and populate in the Classification field (seperated by commas or semi-colons).
This possible?

View 3 Replies View Related

Multiselect Listbox Passing To A Field

Apr 19, 2005

OK - I have seen the other posts where individuals are trying to select multiple items from a list box and have a field populate with the selections. I have not seen a clear explanation defining if this is possible.

Essentially, I want to be able to query on the field and search for multiple selections within that field. Any recommendations as to how this can be achieved?

My next question, is if the selections in a multiple instance field are separated by a comma or some other character what is the best method to query for multile responses. For example, if the following data is in the field 1,2,3 and I want to query on 1 or 2?

Regards,
PolarBear

View 3 Replies View Related

Passing OpenArg To Listbox On Other Form

Aug 11, 2011

On the first form I have a button with the following OnClick event :

Private Sub Rispondi_Click()
acbReceiveMail
On Error GoTo Err_Rispondi_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmSendMail"

[Code] ....

On the form opened upon click ("frmSendMail") I am trying to populate the "cboTo" combobox with the "txtFrom" value from first form. In the OnLoad event I have written :

Private Sub Form_Load()
Me.cboTo = Me.OpenArgs
End Sub

Anyway after clicking the button that should open "frmSendMail" I get a popup saying : "An expression you entered is the wrong data type for one of the arguments" (run-time error '2498') ....

View 7 Replies View Related

Computed Values Are Not Saved In Database Table

Jul 26, 2005

Hi Experts,

I am beginner to Ms-access database. I want save value of A(5) - B(3) into C but, when i check the field C, i find 0 instead 2. Please advice me what i need to do to achive the exact value in field C.

Regards,
Saied

View 3 Replies View Related







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