I have a report which asks for the beginning date and ending date which they want. The report is generated using this information. I want to put the information entered in the parameter request into the heading of the report. How do I recover this information to put it in.
I have a form whose data source is a select query, q3, that is built from 2 other select queries. I'll call them q1, q2, and q3. q1 is a parameter query where I enter a "Cutoff Date" that the 3 queries manipulte and generate the desired results that appear in the form. The problem is that I don't know how to capture the parameter "Cutoff Date" from q1 to display on the form.
I have to print a label quickly every time that the product hit the warehouse. The label has been created as a report linked to the query that will provide the info to the report. In order to make this report printing as quick as possible the idea is to scan the sample id from the product and once the label is printed scan the next sample and an on.
I'm not an expert on VBA but I have created the following scrip but the reports doesn't pop up.
Here is the code:
Dim SampleID As String SampleID = InputBox("Enter Sample ID") If SampleID > 0 Then DoCmd.OpenReport "rptGRM_QuickPrintLabelDymo", acViewPreview, , "[Sample]=" & SampleID Else DoCmd.Close End If End Sub
To facilitate input of special graphic characters such as the degree C and plus-and-minus symbols, I would like to use Alt-1 to Alt-9 key combinations, capture these keys in a KeyDown event procedure and change the keystroke to the desired graphical character code. I am using Access 2010 on Win7.
I first attempted to change the Shift integer to zero to reset the Alt-bit and set KeyCode to the desired character code, but this does not work. Hence I try to use the second common method of setting KeyCode to zero and use SendKeys to VBA-input the desired graphic character. However, strange things happens.
The test code is as follows:
Code: Private Sub TestTB_KeyDown(KeyCode As Integer, Shift As Integer) Dim i As Long If (Shift And acAltMask) <> 0 And KeyCode <> 18 Then ' For i = 1 To 20000000 this For-loop is initially commented out ' Next i
[code]....
The above code as it is works OK and the '#' is successfully inputted to the TextBox field.However, if I comment out the MsgBox statement, the program waits for about 0.3 second and then instantly fills up the entire TextBox field by a large number of '#' characters.
If I move the MsgBox statement to after the SendKeys, no '#' character is inputted to the TextBox.If I comment out the MsgBox statement and activate the For loop at the looping count amount (but not much less), the program works fine.
Please can someone tell me how to go about adding to the code below. Currently the user enters the date criteria in a form. This works great and the data is exported to excel. But I can't seem to figure out how to get the input from the user to also be exported to Cell A1 in excel. Example: if the user enters starting date and end date, that information should be placed in the A1field in excel. Thanks for your help.
Public Function ExportDataExcel() Dim strFilePath As String Dim strFileName As String Dim strFileTemplate As String Dim strMacroName As String
If (MsgBox("You are about to generate the LAR Monthly Report. Are you sure you wish to continue? You cannot cancel this procedure once started.", vbOKCancel) = vbCancel) Then Exit Function End If
'''''''''''''UPDATE THIS DATA WITH YOURS'''''''''''''''''''''''''''''' 'Fill in the following with your files and path strFilePath = "R:Call CenterCall Center DepartmentsMortgage DeptMortgage Statistics & Tracking" strFileName = "Output.xls" strFileTemplate = "Template.xls" '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''
'This deletes the old file Kill strFilePath & strFileName 'This recreates your file with the template FileCopy strFilePath & strFileTemplate, strFilePath & strFileName
xl.ActiveWorkbook.Save 'The Application.Run will run the Macro(s) that you saved in your spreadsheet xl.Application.Run "'" & strFileName & "'!" & strMacroName xl.ActiveWorkbook.Save
'Uncomment/Comment these to close out the workbook xl.ActiveWorkbook.Close xl.Quit DoCmd.Close acForm, "frmLar" Set xl = Nothing
End Function
Private Function ExportData(strQuery As String, strSheet As String) Dim intR As Integer Dim dbs As DAO.Database Dim rs As DAO.Recordset Dim qd As DAO.QueryDef
'After you open that Object/Workbook, you refer to that workbook now as 'xl'. You will 'use it later, but now you have to access your queries through this code and to do so 'you need to use a recordset. 'strQuery is the name of the Query that you passed with the Function. You can also 'use an SQL string.
Set dbs = CurrentDb 'QueryDefs (0) 'QueryDefs ("name") 'QueryDefs![name]
'Set rs = CurrentDb.OpenRecordset(strQuery) rs.MoveLast 'moves to the last record rs.MoveFirst 'moves back to the first record
'You can use record count to make sure there are records in your Query/Recordset If rs.RecordCount < 1 Then 'There are no records MsgBox "There are no records for " & strQuery Else 'There are 1 or more records. Now Select the sheet that you will be exporting to xl.Sheets(strSheet).Select
'Now you need to loop through the records. 'intR' was dimmed at beginning of this 'function and will now use it to create a loop or 'For, Next'
'Starts with record 1 and gets the count of records in the recordset so it knows where 'to stop. For intR = 1 To rs.RecordCount 'Now we need to export the recordset/query to the workbook/object we opened earlier. 'Remember 'rs' refers to the recordset & 'xl' refers to the workbook
'xl.cells(ROW,COLUMN).VALUE = rs.fields(INDEX). 'This is how you will fill in the value of a cell on the workbook. For the ROW you 'will want to add + 1 if you have Headings on your sheet. The INDEX for rs.fields 'refers to the columns of the recordset/query. The first column of the recordset 'starts with the index of zero.
I have a query that has a date/time field (mm/dd/yyyy hh:mm:ss), I have created another field using the following syntax " Sdate: Format([AgentCallDetailInCalls.StartTime],"Short Date") ", I prompt the user for a date using this sdate field I created. The prompt syntax is [Please Enter Start Date]. Currently you have to enter 2/22/2008 (with slashes), I would like to enter 2222008 (without the slashes) to extract the data. The mask I have setup, does nothing. If I put in the date without the slashes, I get nothing, if I put in the slashes, it runs perfectly. Does anyone know a way around this? Thanks in advance for your most knowledgeable response. :confused:
I am not a programmer and I don't know VBA/VB. I am using this as a workaround to avoid VBA functions (since I don't know them). I can't seem to find a simple? solution to this. I have a query that does a radial search in decimal degrees. I have created an unbound form as a dialogue box that converts degrees-minutes-seconds to decimal degrees and displays the results in a calculated text box. What I want to do is have the query take the results in the calculated text box as its parameters (along with a third parameter- distance) without prompting the user. How do I get the query to take its results from the fields on the form? I have tried Like [Forms]![frmName]![SearchValue], but I can't seem to make it work.
Every time I run a query that I have created it asks me to input Expr1 and Expr2 in an enter perameter value pop up box. I don't enter anything, just click okay and the query runs as expected.
Is there a way to get rid of these? (and maybe more importantly, why do they appear?)
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!
I have a table which holds information on audits that have been carried out on staff member's actions. The 'Supervisor' field is populated via a combo box which is linked to a separate table (tblSupervisors).
I am now trying to build a query to allow me to extract all audits that have been carried out on a specific supervisor - rather than the criteria to be [Enter Supervisor Name] and allowing text entry, I thought it would be better to have form that pops up with a combo box that is used to select the supervisor (from tblSupervisors);
So far:
- Form "Supervisor_Select" is created, and has a combo box that looks up from tblSupervisors
- Macros as specified in the instructions are created (Open Dialog, Close Dialog, OK and Cancel)
- Query is done, all bar the criteria expression on the desired field.
- Module is created as described in the instructions, and is called "Supervisor_Select"
I have tried putting the following in the criteria;
[Forms]![Supervisor_Select]![cboSupervisor], however I think I am missing the bit where the query opens the "Supervisor_Select" form?? Will this only work from a button where the on click event runs the 'Open Dialog' macro and then runs the query?
I have created a query with the parameter for the Domain field. however on the form the user enters this information via a drop down menu. i was just wondering could the parameter box be set to a drop down box as well to save the user entering in the full Domain field name?
Hi, I've read a few posts regarding removing the facility of the F11, open Db window, but is there a way to capture if someone presses F11? I have a few people (users) who think they know a thing or two about Access and I'd like to know if/ when they're accessing the Db window.
I was hoping for the ASCI code or similar for the F11 key!? Thanks Matt
Table has a single field (AllocAmt) that is repeated for each detail transaction. Therefore I can't put the sum of the single field on the report because it adds that sum times the count of the detail.
The solution I attempted was to create a subreport using a summarized query then divided the summarized AllocAmt by the count of the same field and got what I wanted. It worked beautifully. I named the calculated field and then created a sum of the new field (SumAllocAmt) in the subreport report footer. I ran the subreport and my totals came out fine.
Then I added the subreport to the original report and the information for each grouping came out fine.
Now my problem ... when I call the field ('=srptAllocAmt.Report!TotalSumAllocAmt") I created in the subreport report footer it does not give me the total for all groups in the original report. In fact it gives me the last record amount instead of a total. When I enter the expression "=Sum([sprtAllocAmt].[Report]![TotalSumAllocAmt])" and try to run the report a box pops up requesting a "Parameter Value" for the field sprtAllocAmt.Report!TotalSumAllocAmt. Why doesn't it recognize that I want a sum of the field contained in the subreport? I've gone to the properties box in all the subreport fields and made the data available "overall". I don't know what else to try. Any suggestions?
Is there a way I can display my parameter in my report? I have a report that's generated from a parameter query. In a control I want to show what the parameter values are: Between [start date] and [end date]
Is there any way to avoid the error code when using the date parameters in Report header when there is no data for the specified range. The following are the parameters being used to get the date range. They work fine as long as there are records in the date range entered.
=Reports![Toys and Adapted Equipment Centre Signed Out By Date Range]![Enter Start Date]
=[Reports]![Toys and Adapted Equipment Centre Signed Out By Date Range]![Enter Final Date]
I have a report based on a query with a between two dates parameter (Begin date and end date). This parameter is fed from a form. All works well - query, form and report. My question is can the date parameter appear on the report header so users know the report was based on a start date of 1/1/2008 and an end date of 1//2009 for example?
I have a database with loads of different sales data from Jan 2014 with other product details as well. I also have a form where the user can input any of these data (this is based on a query):
- Campaign name - Exact Date - Month - Year - Category - Campaign Type
This should run the query, then open a report that's grouped by:
1. Year 2. Month 3. Exact Date 4. Dem name
Even if the user inputs the month and year on the form, when reopening the report, it prompts for inputting the year and month as well, but nothing else.
I have a form that records when a user edits a record. This change is only recorded when the user clicks the "update record/save" command button. What I need help with is capturing the changes made when a user edits the record in any field and doesn't click the save button upon closing the form. If the user doesn't edit any fields in the record, a new instance of this edit will not be saved to my edited records table and the form just closes
Hi All, I'm a novice to Access and I need some help developing a form page where by users can input and record daily project activities.
I have most of the form complete, however, i find that when a user accesses the page the previous record is sometimes showing. How do I setup my form page so that all fields are blank everytime? And how do I set it up so that a user can't scroll through records in the form screen.?
I need to insert the parameter dates for a query into a report. I have tried all the methods I can find but none seem to work. I think its to do with the way my queries are structured.
I have a basic query (q1)! Based on this is a grouping query (q2)! Based on this grouping query is my report. I have set up a form prompting for the parameter dates. This all works ok and my report displays the correct data (between the dates entered). The problem is that I cannot get the report to show the parameter dates.
I have a database with which I use to generate reports as pdfs to load to a website.
However when I go to save the file as a pdf it is always as the report name.I am trying to automate this by using a macro as I need to run a report 50 times for ships with a different parameter each time (name of the ship) Another report needs to be run about 30 times, this time the parameter being a date And finally two other reports, but I can live with those being the name of the reports.
Firstly can this be done?
Secondly which would be the best way?
I've tried using the macro route by I run my Report "Main_Ship" with a where clause of [ship]="wiltshire". This produces the report with the relevant ship, but I am then unsure what to use next to save it as a pdf with the name "wiltshire" using the macro route.
or
Create a VBA routine that runs the report as many times as required each with a different parameter for the name of ship or date.?
I have a database that I created that uses a form to fill out information about server builds. I contains information about who built it, the IP address, server name, etc. I want to be able to create a dailog box that allows the user to input a server name to query the database and create a report based on that input. And if the user input isn't found in the database, a dialog box comes up with some sort of error message. I am still pretty new to Access, so the more detail you can give me the better. Thank a lot.