Hi. Basically, I've been having trouble with this for a while now. I thought I got it working yesterday, but it turns out not. Here is the situation.
I have built a form that contains several combo boxes and a few text boxes for input. The user enters some or all of this information and clicks "Generate Report". Upon clicking this button, the form needs to launch a generic report that is populated with data using the search terms specified in the form. However, to add complexity, only certain parts of the SELECT and FROM clauses can exist depending on which options are completed on the search form.
I tried: DoCmd.OpenReport stDocName, acPreview, sqlQuery, whereCond
Where sqlQuery changed based on which settings were specified. However, this did not help because the actual query that belongs to the Report never seemed to change: sometimes it was missing columns.
I tried also to set rptNominationsList.RowSource = sqlQuery, but that also doesn't seem to work. On this one I get "Object required".
What I'd like to do is place a Calendar on a form, then either click or double click on a specific date on that calendar to pop up a report showing records for only the date selected on the calendar. I have an ActiveX Calendar on my form, but I don't see any Event Procedures for Click or Double Click, just Update, Enter, Exit, Focus. Also, if that is not possible, can you select the date, then click a command button to do it instead?
Ok, so I have a form that I am using to apply certain parameters to a report. The form allows the user to specify one or more fields to sort by and then launches a Report with those statements in the Report's where clause using DoCmd.OpenReport. However, when certain fields are searched, I need to add information to the SELECT and FROM parts of my Report's query. I can't figure out how to do this with Access, if it is even possible. Otherwise, I will need to find a way around this.
I have created a report that prints a transaction input via a form. All the data has been posted to tables while the document details are still on the form. The source for the report is a query that gets its "Document ID" from the current form as its CRITERIA. This works fine. I click a button and the report prints.
Now I've added a datasheet that lists all the "Document IDs" that have been posted within a given date range. I've added a Macro to open(reprint) the same report when any Document ID is double-clicked. This is working except that it prompts for a Parameter Value and references Forms!DocDataEntry!txtDocumentID. (Note: this is the name of the original data entry form which is no longer open)
If I manually type the Document ID (that I just double-clicked) in the parameter box, the report prints correctly. But this shouldn't be necessary.
I know I'm missing a WHERE clause on the Macro that opens the report but nothing I've input works. I can't even hard code a document number. Actually any Where clause provided prompts additional parameter boxes to open and they ALL require the SAME INFORMATION... the Document ID.
I'm thinking that the Criteria on the Document ID in the query should be changed to allow a Document ID from any active source.
I want to link files that are associated with a row in a table. I have added a field to the table that contains the file name and have added a field on my form to display the filename. I have set the "Is Hyperlink?" option to yes on the properties panel. But when I click on the link, nothing happens. I get no error message, nothing. I want to be able to link, word, powerpoint, visio, etc. Any suggestions?
Hello. Your help is very much appreciated. I want to launch the "partial replica wizard" from code. Can it be done? (It is located in Tools -> Replication ->partial replica wizard
I have a drop-down list that I want to populate from one of the columns in a table. But i want to do this with VBA, instead of building the query.
The reason for this is that I'm saving the project as an MDE file, and my database is residing in another *.mdb file. Thus the MDE file is just the executable version.
I can't seem to "read" the table without using VBA to do it.
following problem: 1) a textbox gets value from a combobox 2) after selection in combobox value exists in table but isn't shown in textbox until form is closed and newly opened
-> how do i requery so that the value that is existing is shown instantly??
I have the following code in the second combo box on a form
Me.cboReportType.RowSource = "select fldReportTypeID,fldReportType, fldFrom, fldTo, fldDue from tblReportType Where fldReportTypeID Not in (select fldReportTypeID from tblReport) order by fldReportType"
right now this code is filtering so that once a specific reporttype is used that specific reporttype does not appear again as a choice HOWEVER i need it to do this for a specfic record chosen in the first combo box...at this point once a reporttype is used for one record it does not appear again for any record -
the first combo box rowsource:
Me.cboProject.RowSource = "select fldProjectID,fldProjectNo, fldTitle, fldPurpose from tblProject order by fldTitle"
I know that for 1 column in a combo box you can say cboBox = a;b;c;d;e;f; But for my situation i need to have multiple columns... Does anybody know what the string should look like for multiple columns of values ?
I am trying to retrieve a record from a table (M_Paint) using a text box (txb_oldrecord) and a command button (cmd_getrecord). I want the record to show up on a list box (lst_display). I have written the following code: Code:Private Sub cmd_getrecord_Click() With Me.lst_display .RowSource = _ "SELECT [M_Paint].[Old_Code], [M_Paint].[Supplier], [M_Paint].[Old_Color], [M_Paint].[Metallic], " & _ "[M_Paint].[Color_Number], [M_Paint].[Finish_Comments], [M_Paint].[Size], [M_Paint].[Number_of_Samples], " & _ "[M_Paint].[Project_Number], [M_Paint].[Date_Received] " & _ "FROM M_Paint " & _ "WHERE [M_Paint].[Old_Code] = '" & Me.txb_old_rec.Value & "';" End With End Sub When I test this, I get the following error: Quote: Data type mismatch in criteria expression.
Ive posted similar in the forms section but it has gone unanswered so I've pulled out the offending query and hope someone here can offer insight into this frustrating problem.
I have a form [Training Record] that has 2 combo boxes.
Box A (course_title_combo) has the titles of the various training courses. It pulls 2 columns from the training_courses table, namely courseID and course_title. Only course_title is shown in the box. The control source of this is set to CourseID as this is the field to be written to the training_record table, showing who attends what course.
Box B (course_date_combo) is MEANT to pull through the dates that each course is on, by pulling through the course dates for each course where courseID (as selected by combo box A) is equal to the courseID in the course_dates table.
Here is the current rowsource query for box B - which is basically showing blank fields...
SELECT tbl_course_dates.course_date, tbl_course_dates.CourseID FROM tbl_course_dates WHERE forms![training record test form]!course_title_combo=tbl_course_dates.CourseID
I cant see what is wrong with the query, but Im guessing it must be wrong as it is the rowsource which determines what is included in combo box B.
Any help would be appreciated no end - im totally stuck now :(
I have a combo box on a form for which I want the available values to be a subset of the values from a table (which I can do), but for older records, I want the combo box to be able to display any value from this table.
(The combo is to select a member of staff who has been assigned to a case, and I only want current members of staff to be available for new records, but want to be able to display older records which relate to members of staff who have now left.)
The only way I can think of doing this is to have LimitToList = False, but that defeats the object of having the drop-down list in the first place.
Can anybody suggest a way of doing this please? I can get round it by having a text box AND a combo box, but wondered if there was a way to do it with a single control.
I have a reset button that restores my combo boxes and list boxes to their default values. I want the 'on click' event on the reset button to first clear all the existing values before it resets them to their defaults. Does anybody know how can I do this?
The reason i need to know is because, if the user presses reset again, I get an error message because those values are already inserted in their respective boxes. And since I'm using queries from tables as the rowsources for these combo and listboxes, I get an error because it will not allow duplicate values. Yes, it's true that I don't want duplicate values so i just want the values cleared first. , so that the error doesn't have the chance to occur.
I have a form that has both a Make and Model field and I am trying to set it up so that when the Make is selected or changed the Model Query filter updates.
I have read other threads regarding this matter but am still unable to get it to work. The Form pulls from one table (tblPCInfo) while the query pulls form another (tlkpProductsServer). Also the cmoMake ComboBox pulls from table (tlkpProductsCategoryServer)
Model Query: SELECT tlkpProductsServer.ProductID, tlkpProductsServer.ProductName, tlkpProductsServer.ProductCategoryID FROM tlkpProductsServer ORDER BY tlkpProductsServer.ProductName;
I want to add a WHERE parameter to filter for the current ProductCategoryID which comes from what is selected in the Make Combo Box
Code I have Tried: Private Sub cmoMake_AfterUpdate() Dim strRowSource As String strRowSource = "SELECT qry_Model.ProductName FROM qry_Model WHERE qry_Model.ProductCategoryID=frm_frmPCInfo.cmoMake" Me.cmoModel.RowSource = strRowSource End Sub
I am not sure if this is enough info to go with and I just started learning VBA so I know this is probably a mess.
I have a basic SELECT DISTINCT query for my CBO rowsource. Is it also possible to add custom values to the rowsource? i.e. I'd like my CBO to look like....
I have a list box with a query as its row source (screenshot attached).
The query gets data from my Contracts table with information on a Consultant ID, Contract ID, and a Contract Status indicator. This effectively represents each contract with a specified status.
What I'm trying to do is allow the user to select a specific contract from this list box, and for my main form to open and display the actual information on the contract they just selected.
A little background on my main form, the main form consists of a main page followed by several Pages, with a subform in each. Thus, my contract screen is designated as Forms![frmConsultantList]![sbfrmContracts].
So, what I'm trying to do right now is collect multiple fields from the selection the user makes (on the listbox with the query row source). To further clarify, each line has a Consultant ID and a Contract ID. How do I pull each from the user's current selection on the listbox and assign them to new variables? As of now, I am only able to select the first field in the list (Contract ID) and assign it to a variable.
How do I do this, or is there a better way?
I apologize if I'm unclear about my situation, so please feel free to ask any questions. And of course, thank you to all those who spend time reading this.
Hi all, I have a combo box which gets it's values from a table. It also has a where statement to filter the data given the value in another combo box. I.e. SELECT DISTINCT Table1.some_field FROM Table1 WHERE Table1.some_other_field = Forms!frmSomeForm.Combo_box The first time I change the value in Combo_box combo box it will filter the values in my other combo box. But when I change it successive times it doesn't refresh the query, so the same values stay. Any suggestions?
Can someone help me out with this.. I have a listbox in a form that the rowsource changes based on search criteria.. The rowsource is a select query... I am trying to do two things:
1. View the query in a datasheet view with the click of a button that I've created..
2. Export the query to excel with a click of a button
I have started to set the query as a string by doing the following...
Dim SEARCHQUERY as String SEARCHQUERY = LISTBOX.Rowsource
Whats next? I tried: DoCmd.OpenQuery SEARCHQUERY
but it doesn't work... This command only opens an existing access query..
I have a form with many comboboxes. The comboboxes need to have their original rowsource set to a table in my database. However, when the user selects a value in a combobox, it is programatically fed into a SQL string which serves to populate a subform. This part all works great.
However, I'm trying to reset the comboboxes as well so that options will "narrow down" until only a single option is possible. So far, I have:
Code: Private Sub cmb_Author_Change() Dim strSQL As String strSQL = "SELECT tbl_Records.RecordName, tbl_Records.RecordDistinction, tbl_Records.Title, tbl_Records.Author, " & _ "tbl_Records.ProjectManager, tbl_Records.[Site Name], tbl_Records.ChargeCode,
[Code] ....
GetWhere() is the portion that feeds info from the comboboxes to the Finder string.
The red highlighted bit is the part I'm working on. Obviously, once I figure out the proper syntax, all of the other comboboxes will be set up the same way.
What's funny is that in testing (all of the data currently input is simple and allows me to select options where I know what the response will be in other boxes), when I change Author and go to use cmb_RecordName, it replies that "the record source 'My Data' specified on this form or report does not exist" (where 'My Data' represents real data).
So, clearly, it is finding the data, just not using it as a record source, but rather believing that the name of the recordsource is the value.
I'm trying to change a rowsource depending on the value in a form. I want to be able to change the value and update the form accordingly. I can change the query but when I try to add the "where" statement to it, I get nothing.This is what I'm using:
Private Sub RepID_AfterUpdate() Dim strSQL As String strSQL = "SELECT DISTINCT [Cust No] & ' ' & [Name] FROM [Address Book] WHERE [Address Book].[Cust No] = '" & [RepID] & "' " Me.NamesList.RowSource = strSQL NamesList.Requery End Sub
I would like to update the SQL for a subform. I have an SQL statement that I have placed into a string and now I would like to update the subform using it's RowSource property, but I get an error when trying to use the following statement: