Macro To Open Form When Report Is Selected
Sep 16, 2014
I have a report that is based on a query. The query has filters in it based on user info entered from a form. So the form asks the user to select which division of the company, and the date range for when the info applied to. My issue is that I am trying to set a macro that opens this form whenever some tries to open the report.
But the macro appears to run the query before it opens the form and it gives me a generic message box asking for the division. After I type that in (instead of selecting from a drop down list like I have on my form) another window pops up asking for start date, etc...instead of opening the form I created. What am i doing wrong and how do I get the macro to open my form? If I open the form directly and enter the criteria, it runs the report correctly.
View Replies
ADVERTISEMENT
May 1, 2012
I have a parent form showing some of the contents of a single record in a parent table. This form contains a button that opens a specific subform (using an IF statement based on the contents of another field in the parent table/form. There are actually any of 8 child forms/tables that could be selected and the related record is in only one of them. The relation between the tables is based on the PK of the parent table and the related FK in the child table. and the data is correct in all tables.
My problem is that when I run this button on the parent form/table it returns the appropriate form/table, but displays the first record rather than the related record. In the past (using this same process) I have been successful in getting to the right record by fiddling with the where statement (sometimes putting in a equal sign or taking it out fixes the problem). However, no matter what I do to the Where statement nothing works. I have not yet placed the final else condition for where the form selection field (VMValIdentType] is empty yet as there is no point at this time.
Here are the button macro contents:
If [VMValIdentType] = "Software"
OpenForm
Form Name: tmpVMValSW
View: Form
Filter Name:
[code]...
View 7 Replies
View Related
May 11, 2012
I have a bunch of reports that need to be printed, but only if they include a certain date. I want all of the dates to show up though.
For example:
There are 3 reports with a bunch of different dates in the bill date column.
Reports A and B include the date 04/30/2012, along with a bunch of other dates.
Report C does not include the date 04/30/2012.
i want reports A and B to open since they include the date 04/30/2012, and I want all of the other records with other dates to show up on the reports along with records with a date of 04/30/2012. I do not want Report C to open at all.
View 2 Replies
View Related
Feb 23, 2015
I currently require a macro that takes the record and when clicked, it opens a form and displays this record. This is so that I can use it to click buttons and open existing reports based on the data and field that match the 'clicked' record.
View 1 Replies
View Related
Dec 6, 2006
Hi All
Can someone help me with opening a form from another form using the OnDblClick event and to open the form using the data in the record to open it at the same record. ie Site Name = CP House so the form opens with CP House data showing, Site Name = St James so the form opens with St James data showing etc.
Thanks
ChrisD
View 1 Replies
View Related
Aug 11, 2006
Hello, I have a form that I will need to allow users to be able to go back and find a specific record and edit it. I have a control number to uniquely identify each record. I have a main data entry form where the subform has the unique value in it. Can I run a macro to ask the user what control number they are looking for and then open the data entry form to that specific record?
View 1 Replies
View Related
Dec 21, 2006
I really hate being stupid about this, but I'm running around in a circle and it's making me dizzy. All I want is a simple macro that opens a form (with a subform) at a new record from a button. I know I am missing something obvious so I will let others see if they can find out what has gone wrong. The current macro is:
OpenForm(FormName)..View(Form)..DataMode(Add)
GoToRecord .. ObjectType(Form) .. ObjectName(FormName) .. Record(New)
On the property sheet of the form the following are all set to yes:
Allow Filters, Allow Edits, Allow Deletions, Allow Additions, Data Entry (I suspect the problem is here)
Record Locks is set to No Locks.
When I open the form from the button, it looks right, and I can enter the transaction information, but when I try to enter the subform information or save it , I get "The Microsoft Jet database engine cannot find a record in the table 'NewContacts_tbl' with key matching field(s) 'ContactID'". I get the same message with Allow Data Entry set to no.
And yes the key field IS there, in spite of what the Microsoft Jet database says.
I hope everyone gets a chance to enjoy the holidays and thanks to all of you for your past help and my current (relative) sanity.
A2K
:(
View 3 Replies
View Related
Mar 20, 2008
I have a form that updates records. When the user opens the form in data entry mode, it is too difficult to find the correct record. What is the most efficient and simple way to have the form open to a specific record?
Solutions I have considered are a popup form that the user will enter the equipment code (which is the unique identifier of all records). Also, the user may not know the record number, but they will always know the equipment code (which is a field in the "equipment" table).
But I am not sure of the best way/best order to do this.
Thanks.
View 14 Replies
View Related
Mar 7, 2013
I have a button using a macro to open a form in Hidden mode. Then I have another button on another form to open this form that was hidden.
When I open the form, the form is virtually blank apart from the form caption name. But when I close this and press the button again the form opens as normal.
I do not understand why?
I was told that once you hide the form and when you open the form again, it should appear normal. Why do I get this blank form??? Only by hitting the button again then the form is normal....
View 13 Replies
View Related
Dec 13, 2006
Yet another question.
I have a listbox on a form that show all Files for a particular volunteer. I have an "Edit File" button below the listbox to be able to edit that particular file. Is there a way about opening that form to that specific record without using a query?
Thanks
ScrmingWhisprs
View 12 Replies
View Related
Jan 19, 2005
Hi folks,
I have created a form, which extracts records from a table and displays them in
a list box. This works, but what I want to do next is highlight a single record in
that list box, click a button and have the record open in another form. This is
the code I have at present:
Private Sub DisplayEnquiry_Click()
On Error GoTo Err_DisplayEnquiry_Click
Dim dispCriteria As String
dispCriteria = "[SupportEnquiriesTable].[EnquiryID]='" & Forms![Search All].[ListSearch].Column(0) & "'"
DoCmd.OpenForm "Support Enquiries", , , dispCriteria
Exit_DisplayEnquiry_Click:
Exit Sub
Err_DisplayEnquiry_Click:
MsgBox Err.Description
Resume Exit_DisplayEnquiry_Click
End Sub
When I try this I get an error "The OpenForm action was canceled. You used a method of the DoCmd
to carry out an action in Visual Basic, but then clicked Cancel in a dialog box."
I've double-checked that I've typed in the correct names etc. so I am at my wits end!
Can anybody help me out?
Thanks
View 1 Replies
View Related
Sep 29, 2006
Hi again,
One last one that's been niggling me - I just can't fathom the code... I bet it's very simple...
I have a Form ("frmJobSummary") that shows all the jobs for a customer - the customer is selected and the Customers ID is stored in a Control called "CustomerID" (It's just a number)
I have a button that opens up a new form... "frmEditJob" This allows you to add a job to a customer. I know how to get it to open up as a new record... but...
How do I get it to open up as a new record (or job) for the customer selected on the form "frmJobSummary"?
Here's the code so far... all it does is open the form with the Current record. :(
Your help is, as always, most appreciated!
Private Sub OpenNewJob_Click()
On Error GoTo Err_OpenNewJob_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmEditJob"
stLinkCriteria = "[CustomerFK]=" & Me![CustomerID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_OpenNewJob_Click:
Exit Sub
Err_OpenNewJob_Click:
MsgBox Err.Description
Resume Exit_OpenNewJob_Click
End Sub
View 3 Replies
View Related
Aug 8, 2013
I'm developing a database where people basically can fill in an order form and then the database can track if the order has been placed, when it came in etc.I have a form called frm_Suppliers to be Ordered that runs off a query. The tables that relate to the query are called tbl_Products, with a primary key called ID and tbl_Suppliers, with a primary key called Supplier ID.
The form called frm_Suppliers to be Ordered, shows a list of suppliers that have open orders. Each supplier may have several orders open. I want to be able to click a button after each supplier name and bring up a continuous form that relates to all the records from that supplier that have open orders.
I have tried using the code found in the thread called "open a form based on the record that is selected in current form" from 06-08-2011, however it will only work when my form lists each open order separately, not when they are grouped by supplier.
View 2 Replies
View Related
Apr 10, 2013
I have a macro set to email a form to a person once a condition is met. This works fine but I've discovered that Outlook (2010) has to be open BEFORE this macro is invoked.
I wanted to add a step to the macro before the one that makes it email that basically says to open Outlook.
I have tried the RunApplication macro, but I apparently am not getting the path right. I don't understand what the problem is.
I accidentally dragged Outlook to my desktop and therefore created a shortcut from my Start Menu, but now when I go to Microsoft Office in my Start Menu, Microsoft Outlook isn't one of the options. I can't find the path to where it may reside now.
I am using the path to the shortcut on my desktop.
C:UsersJust MeDesktopMicrosoft Outlook 2010
What else am I supposed to do?
View 8 Replies
View Related
Nov 8, 2004
I am trying to create a table of help messages and display them help in a form. Using MSAccess.
Each Form used will have a help button, that runs a macro "mcrHelp.xxxxx". This macro should select the relevant record from the table to display in the "Help Form".
But i am having problems selecting the records.
Ex.
Macro name: mcrHelp.Help1
Table name: tblHelp
Fields: HelpId HelpTitle Description1 Description2
Data: 1 Help1 Sentence 1 Sentence 2
Form to display help in: frmHelpScreen
I want mcrHelp.Help1 to select the Help1 record from tblHelp and display Sentence 1 and Sentence 2 in the form frmHelpScreen.
Each time i try the macro i have i get the first record displayed in the form.
Many thanks
View 1 Replies
View Related
Mar 10, 2015
I am using MS Access 2003.
I would like to open the form = VendorPayables_Maintenance_F
Choose a cheque number
Print the cheque
How to create a macro to
close the open report = d_One cheque information
and close the open form = VendorPayables_Maintenance_F
View 2 Replies
View Related
Apr 19, 2005
Hello all.
I would like to place a "Print Report" button on my primary form that allows a Filter By Selection (OR Filter By Form) first, then when selecting the button will view or print my already-created primary report but only for the records that were selected by the filter.
I looked and looked, but am not sure even what to search for in the forum. I know this has to be simple.
Form is called PrimaryForm.
Report is called PrimaryReport.
Thank you.
Tom
View 3 Replies
View Related
Jan 2, 2014
I'm trying to create a form which filters a report based off of combo boxes selected by the user. The code I'm using currently is:
Code:
DoCmd.OpenReport "rptProgramAttendees", acViewReport, , "ProgramIDFK = " & cboProgramTitle
This works great to return a report if the user selects something from the combo box. How do I adapt this so that the user can also leave the combo box blank and filter the report to return all records?Additionally, what if I want to have the user filter between dates selected on the form; i.e. between 'txtStart' and 'txtEnd'
View 10 Replies
View Related
Nov 28, 2007
I need to find a way to close a file (spreadsheet) if it was left open by a user before my scheduled macros need to delete and remake that file to update it. Is there a way to do this in Access? I've been looking for scripts everywhere... Any help is greatly appreciated. Thanks, Rick.
View 1 Replies
View Related
Dec 8, 2014
I'm very new to access database and I'm trying to create a macro that allows the user to enter data after seeing a mistake in a form. I need a macro that will open the specific table and record of a piece of data. For example there is a student TestName3 whose grade on a competency is 30% but should really be 45%. I want a macro by the competency percentage to allow the teacher to edit that without looking through the entire table. The macro should prompt first to ask if the teacher is sure they would like to edit, second prompt asking for the student's unique ID number, and finally be taken to the specific record and table related to that competency.
I have tried to use a vastly overcomplicated DLookup and Order column to give me the value for a acGoTo search.
Here's what I have.
Option Compare Database
Dim answer As String
Dim response As Object
Dim gotoresponse As Object
Private Sub Command71_Click()
On Error GoTo Command71_Click_Err
[Code] ......
View 5 Replies
View Related
Feb 8, 2005
Good morning All,
I have a form with a command button to open a report ( based on a query ) for the currently displayed record. here is the code I have used:
Private Sub CS_notes_Click()
On Error GoTo Err_CS_notes_Click
Dim stDocName As String
stDocName = "InternalSNwithRMAprodMASData"
DoCmd.OpenReport stDocName, acPreview, , "TLAUnit = " & Me.UnitSN & "'"
Exit_CS_notes_Click:
Exit Sub
Err_CS_notes_Click:
MsgBox Err.Description
Resume Exit_CS_notes_Click
End Sub
I believe this came from this forum sometime. When the button is clicked I receive the error:
"Syntax error (missing operator) in query expression '(TLAUnit = 26712B')'
TLAUnit is the report field, UnitSN is the form field.
Any help with the error?
Thanks
Kevin
View 5 Replies
View Related
Jun 16, 2005
I hae a button on my form to open a report. However, I get all the records in the database when I only want to see the report with the current record from the form on it. How do I narrow my report?
View 9 Replies
View Related
Nov 10, 2006
I need to create a form that will open up to a report. the form is going to have two options.
one option will open up a report that will show all candidates submitted
the other option will open the same report but only show the candidates that have not recieved a no from the employer.
does anyone know what type of coding will need to go into this and how to go about it.
any help would be greatly appreciated.
View 2 Replies
View Related
Aug 24, 2006
Hello, fantastic site you have here!
I have a form based on a table called TermWithPaysStoredData that shows a single row for everyone in the table with a small amount of info from the table and has controls for a user to enter dates which writes to that same table.
I have a subform that reads that same table but has much more information about each row. I would like to add a button to each row of the main form that says "More Info". When clicked, it should open the subform to the same employee.
The field I want to match is called ID. My main form is called fTermWithPays and my subform is called fTermWithPaysMoreInformation.
I tried using the OpenForm method but that either opens the form to the first record or filters and shows only one blank record.
I'd like to use a macro for this if possible because I don't know VB.
Any ideas? Let me know if more explanation is needed.
Thanks very much!
View 2 Replies
View Related
Oct 15, 2013
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.
View 1 Replies
View Related
Oct 21, 2015
Without having made any changes to my setup, Access now crashes when I try to open a Macro in design view. I have checked the Trust Center and the folder where my database is stored is trusted (including sub-folders).
I am running Office Pro 2013 with Windows 8.1.
View 5 Replies
View Related