I have some code for a button on click event to open a form and select the record which corresponds to a value in an unbound text box. The code is:
Private Sub Command25_Click() On Error GoTo Err_Command25_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "frmOpenPatientRecord"
[Code] ....
This works fine when I put in a 10 digit NHS number but opens a blank record when I enter a four digit or six character/digit PatientNumber. Both patient number and NHS number are text fields in the underlying table.
Hi All, I hope I can explain what I am trying to achieve.. I have a "Top 1" query (Qry_Avail_StockItem), which selects the next available record in a table. I have a main form (Frm_MasterStock) with a command button "Add Record". If the user clicks the "Add Record" button, I need the form to go to the record that the query has selected.
The last version of Access I've used was 97 but I'm getting back into it. I've read a couple of things that recommend creating a form based on a query, not a table, especially if a calculated field is involved.
When I create a select query based on 1 table, I can change/add/delete records right in the results of the select query, which will carry over to the form just fine.
However, when I use an additional table and join them in my select query, I can no longer update any of the fields that show in the query result. The link I'm using is just a 1 to 1.
How can I get around this? I'm using the second table just for lookup purposes (use the value of one of the fields in a calculation), but I want to be able to update the fields from table 1 from the form.
I don't quite know if I am heading down a blind alley here. I want to filter a form to show a subset of the records via a toggle button. Click again and you go back to the full record set.
The form is based on a query and the filter is to be based on a copy of the query with several criteria and sorts added. This will result in a record set of active projects comprising about 20% of all records (65 out of 253). The sorting sets the record order to match the main management report and so the Planner can update the active records by navigating through the record set rather than having to search for each record using the Find button.
If what I am trying to do is not the way to achieve the desired result, I'd be grateful for any pointers elsewhere.
Upon closing my frmInventory the amount stock of stock is checked against a minimal stock value. If the stock amount is below a set minimal value a subsequent form is opened telling you that stock is low and an email message is generated to notify a manager. I have a checkbox on that form which is set to "True" upon close using an update query. The checkbox is there to give users the option to either send or not send a reminder message that stock is low when a message has already been sent earlier.
The problem is that using that update query ALL records are set to "sent=true" and not just the 1 record I intend.
This is my code in the "on close" event:
DoCmd.OpenQuery "qryUpdateEmailMinimal_True
and here's the SQL:
UPDATE tblInventory SET tblInventory.emailSentMinimal = True;
I assume what is missing is a reference to an inventoryID number. How do I do that?
Hello all, I have a couple questions. First I am trying to create a select query that will show the results that I have two fields , one is "Date" & the other is "Current" For the date I am using the a between statement "Between [start] and [end]. Under the "Current" I have "Applied" & below that I have "Overage" The problem is when I enter my date range, it shows all records with the Overage or Applied, but if I go & remove either "Overage" or Applied, then it works fine.
Is there somthing that I am missing
Second question is when using a find command box, is there a way to have it search multiple tables, if so how would I set the find box to search both tables, if the table names were called Let say Table 1 & table 2
I have searched and search and I can't find the answer to this question when I thought it would be simple. Hopefully you can put me out of my misery!
I have a access 2007 split form with a series of search boxes and a query result window. Enter info into one or more of the search boxes, click search and you get the matching results in the query window below. That works fine but I want to work with the results of the query, how can I do this?
I was looking for the user to be able to select a record and then click a command button to open that record in a form. Or in another instance select a record in the result window, have the current from close and have the primary key passed to a another form which I use to open the split form.
I just can't see how to do it but I expect there are several ways. Happy to use VBA but my experience is with Excel VBA so I'm still getting used to the objects.
I have a query that I would like to run from a form. I have created the button and the query, but want to add in a clause that will use the user selected record / field as the criteria for the query when its run.
I have a list box bound to a query. If the list box retrieves two records, I am not able to select only one of them. If I click, it gets both records selected ( highlighted ). Is there any way I can select only one record?
Based upon a specific date (varDate), I want to select the record that is active (who drives the lease car).
row 1 user X from 13/11/2013 row 2 user Y from 15/11/2013 row 3 user Z from 17/11/2013
I want to find the active user on a date. So on date 13/11/2013 (=varDate), user X is active, on 14/11/2013 (=varDate), user X is still active, on 15/11/2013 (=varDate), user Y is active, on 16/11/2013 (=varDate), user Y is still active and on 17/11/2013 and later, user Z is active.
Query_Rates (Actually this is the result of a query): Unit R_Date Sold_Rate A 24-AUG-15 145
[code]...
So what I want is a list of all the records from the Query_Rates table where the absolute differences between the sold rates between Query_Rates & [Sent till date] (matching the unit # and the dates) is greater than 1 and the record shouldn't be displayed if it is already present in the [Sent till date] table. But if you notice the first record which has unit A is already mentioned in the "Sent till date" table and shouldn't be repeated again in the query result.
I have a subform containing a list of Funds and attributes such as Asset Type, Fund Manager, etc.
Currently, I have a textbox, where the the control source is set so that it will be updated with the Asset Type from the subform.
I also have an unbound combo box that contains a list of Asset Types queried from a table via row source, where user can select the Asset Type.
What I would like is when a record is selected from the subform, the Asset Type is selected on the combo box as a default value. User can select another Asset Type if required. How can I do this?
Is there anyway to reset a query or macro when you open a new record? My database seems to be holding on to data from the previous record. The data is gained from two queries and one macro.
Table: "Facility Info" Data in the table: "facility", "city", "date", etc. Query: "Q Facility" Report: "R Facility" Form: "Main Form" is where the data is entered that goes into the "Facility Info" table.
In the "Main Form" there is a dropdown box where I can select the "facility".I would like to add a button to this form that opens my report "R Facility". But this report is a collection of all the facilities and I would like it to just report the ones for the facility that I selected from the dropdown box on my "Main Form".
I created a query that shows everyone who has a specific date field blank. Now want to make those names clickable so that it opens a specific form with a certain record related to that individual in the query. Each line with a different individual should open a different person on the form and their corresponding record.
I have a database with lists clients across the UK. I have now been asked to provide options where users can select clients grouped by geopraphical area e.g say clients in Scotland.
I can of course do this but having numerous identical forms where the source queries have different parameters depending on the regions required.
The only problem with this is that I would need numerous forms and queries. Additionally, there are options on the form to navigate to linked forms which would all need to be unique.
What I would like to have options on my main (Switchboard Type) Introduction Form to select the region. The code on the relevent command button would include the parameter. I would therefore not require the additional forms.
The open form codes includes:
Dim stDocName As String Dim stLinkCriteria As String
I feel i need something after "frmClients" such as qryClients.ClientArea = "Not Scotland". Various attempts to incorporate something has created errors.
I am involved in a project that is using a SQL back end. I am having issues with "unable to save" messages when I quit the application. I have noticed that if I close a form to look at something, on many occasions the select query behind the form or subform is open. Is there a way to close all forms, subforms, and queries with VBA without having to identify the exact names, when I use either
I am running MS Access 2010 on Windows XP and my access skills are limited.
So I have a db with tables, forms and reports and would like to give my users the option of opening a filtered report (from a form).
The form (frmSelectStatus) and report (rptStatus) have been created and both open correctly by normal selection from the 'All Access Objects' side bar.
frmSelectStatus has a multi-select list box (lstStatus) and a command button (cmdStatus). When I click cmdStatus i get the correct report opening but it is all status records and not filtered by the selection made in lstStatus - and i know this is a result of not referencing 'lstStatus' in the code. i also have a query (qryStatus) which does not contain anything.
My 'on-click' code for cmdStatus is
Private Sub cmdSelect_Click() DoCmd.OpenQuery "qryStatus", acViewNormal, acEdit DoCmd.OpenReport "rptStatus", acViewReport DoCmd.Close acQuery, "qryStatus" End Sub
I know I need to reference 'lstStatus' but am not sure where or how to do that in the code.
i have this small code to import excel data into mdb file: DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _ "datapub", "D:datapubcolumnar.xls", True, "datapubcolumnar!"
But I want to improve by call a dialog box for user to choose excel file. Could anyone can write this code for me. Thanks in advance.
I am attempting to create a Macro that will export the COMPLAINT table to an Excel Spreadsheet. However Excel does not open and I am prompted to select the Program I want to use. What am I doing wrong?
I would like to select a record from my combobox dropdown list and have that record populate in my subform. Currently, I am only able to select the 1st record at the top of the dropdown list to appear in my subform. But I would like to select any record from the dropdown list and have it populate my subform.
i have a table that holds Electronic Gift Card details (those plastic store gift voucher cards). it holds all details of every transaction for every card, so the card number, activations, redemptions, dates, times, transaction values etc. are all recorded in my table.
i have attached a small extraction in a spreadsheet.
a single gift card can have multiple transactions against it throughout its lifespan. there are sometimes error transactions, and i need to write a query that finds these error transactions (they are all flagged with a "1" in the [reversal flag] field, so that bit is easy) but then also then the next transaction that occurs on that card. this subsequent transaction will not be flagged with a "1", but is a reversal of the error and will have an "802" flag in the [transaction type] field.
each transaction is date stamped hh:mm:ss, but i don't know how to write a query that will
1) find gift card number that has a reversal code of "1" 2) find next transaction made on that gift card based on transaction time 3) check that subsequent transaction type is "802" 4) select both transactions 5) repeat for entire table
i can't seem to get the desired result just using a straightforward query, and i don't know much (or any!) VBA in access.
I have a form "IntUnderwriterSearchByName" which is based on the query "Search by Name". This form opens with a parameter (please enter name of broker) and is set out like a datasheet with the following fields- "Broker Name", "Domicile", "Broker Code" and a couple of others. I'd like to be able to click on a record and open the form "IntUnderwriterPopUp" so that the details of that specified record are displayed.
Broker Code is what I'd like the form to look for and this Broker Code is unique for every one of the 900 or so records. This code can be numerical e.g. 01233 but also can be a mixture of both e.g. EU2885. It is also worth noting that this code is not the primary key- i have an autonumber (called ID) that does this- but this field does not appear on the form.
I am creating an events database. In my main form, I have all the details of a single event (billing code, fees, customer, support personnel, etc.). Then, I have a subform (form view) that lists each of the other services which share an event ID (this ID comes from a separate, unrelated events management suite). In the subform, I display the most-commonly-edited fields so that they are editable without navigating to a different record.
However, there will be instances where it becomes necessary to navigate to one of the records listed in the subform. I would like to make this a quick process by just clicking on the primary key in the subform, and have the corresponding record appear in the main form.
In my searches I've found a common suggestion to use a DoCmd.OpenForm method where the form opens to that specific record -- in effect filtering by the primary key number. I don't prefer this method because it disables the ability to navigate to other records using the previous, next, find records, (etc.) buttons without closing and re-opening the form.
Is there a way to make the main form 'jump' to a specific record by clicking on a control in the subform, without limiting the ability to navigate in the main form?