Run A Macro To Run Query Then Open A Form

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 Replies


ADVERTISEMENT

Open A Form Using A Macro

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

Open Form To New Record With Macro

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

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 7 Replies View Related

Forms :: Macro To Open A Form In Hidden Mode

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

Queries :: Reset A Query Or Macro When Open A New Record?

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

Wrong Record Selected From Macro Of Open Form Button

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

General :: Macro To Email A Form Once Condition Met - Open Outlook From Access

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

Form .. Query.... Macro...

Feb 18, 2005

Not sure where to put this one... So I'll go with forms...
I have a form "Reports Dialog" with 3 radio buttons to pick which report you want to preview and/or print. It works fine. Now what I want to do is add a subform"Select", visable only when the radio button is clicked on. This holds the parameters for the query for the item whose radio button you picked. So I set the subform visable to "NO"
Whats the best way to make it visable when the radio button is clicked? Can I do it in a Macro? Or is it better to put a line of VB in..... And I'm not good with VB yet....... So if that is it what would the code be.
Thanks

View 2 Replies View Related

Form, Query Or Macro?

Oct 7, 2004

How can I make a query or maybe its a macro that can
fill up a form after I enter some information, like the customer
id (i.e. social security). However, if its a new one, than I want
to be able to enter the new information for that new customer.
I really need this guys, can someone help me here?
Thanks,
Enivaldo

View 1 Replies View Related

Form / Query / Macro / Cmd Btn Problem

Dec 20, 2005

My database contains information on many different power plants. I have created a form to retrieve data about a specific plant but there is more information than I can get onto a single page. So I added a command button to the form to retrieve a subset of data using a query. Clicking the command button is supposed run a macro that activates a query with the plant ID number as a condition to recall the specific subset. The query works fine by itself (if I enter the plant ID manually as parameter). When I click on the command button, nothing happens - I do not even get an error message to suggest where to start looking. Anybody have any suggestions? Thanks.

View 5 Replies View Related

Need To Close An Open File Before A Macro Runs.

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

Macro To Open Table To A Specific Record

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

Macro To Open A Report That Includes Certain Dates?

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

Using OpenForm Macro To Open A Subform To A Specific Record

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

Access Crashes When Try To Open A Macro In Design View

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

Modules & VBA :: Document Could Not Be Registered / Unable To Open Macro Storage

Oct 31, 2013

I have a VBA program which is stored in an Access database. The program creates letters using Word template documents as well as new Excel sheets. When one of the users in my team undertakes this process she is unable to create the files (although she could before). The following error message occurs initially for the word documents:

"The document could not be registered word 2010. It will not be possible to create links from other documents to the document"

When I enter debug and attempt to run the code again the file opens but subroutine halts again and I get a different message:

"Could not open Macro storage"

The line of code which is identified for both errors is:

Set wdDoc = wdApp.Documents.Open(TemplateLocation)

Where wdDoc is the a Word.Document, wdApp is a Word.Application and TemplateLocation is the path for the template

I have already checked the following:

- 'Trust access to the VBA project object model' in the Trust centre is ticked and Macro Security is set to none.
- DCOM Server Process Launcher is set to automatic in Services (Local)

View 1 Replies View Related

Forms :: Number Of Buttons Which Open Other Forms And Filter Results Using Embedded Macro

Apr 6, 2015

I have a bit of a problem with a database in Access 2013. On 1 of the forms, I have a number of buttons which open other forms and filter the results using an embedded macro. All has been well until a few days ago when error 2950 pop up box started appearing. After fiddling around for a while it all works OK (without actually changing anything) until next time the database is opened. I checked to make sure the location is "trusted" and all seems OK.

View 4 Replies View Related

Open Query Or Form

Apr 3, 2006

access 2000 have a form with a list box some items in the list box after i click on it i want to open a query and the others i want to open a form help

View 1 Replies View Related

Modules & VBA :: Write A More Complex Macro That Will Start Another Macro At Preset Time

Dec 8, 2013

I am trying to write a more complex macro that will start another macro at a preset time, however I am getting stopped at the first hurdle - getting a macro to run another macro.

Here is the code i am using at the moment, all I want to do currently is click the first button, then get the second macro to execute. But no luck, getting error 2157 "cannot find the procedure"

Code:
Private Sub Command3_Click()
MsgBox "1st macro running", vbExclamation, "Note"
Application.Run "teststart1"
' Application.OnTime TimeValue("19:55:00"), "teststart1"

[code]....

View 1 Replies View Related

How To Open Results Of A Query In A Form?

Apr 17, 2007

Hello. I have a problem which has me stymied. I have created a Query-by-Form in which the criteria for the query is two combo boxes. I had no problems setting that up, but I want to display the results of this query in another form. I know this is possible, but do I need code for this? Any help/suggestions would be greatly appreciated!

View 3 Replies View Related

Form To Open When Query Picks Up Duplicate

Sep 5, 2006

Hi all

I have a form (DuplicateSpot) with a subform whos record source is a duplicate check query. The query checks to see if more than 1 person is assigned to the same spot for a given date. I want the DuplicateSpot form to open when the query picks up a duplicate. This will be part of an On Click event for a button. I'm just unsure of what kind of code I need to go about doing this.

If this explanation is unclear, please let me know.

Thanks!
ScrmingWhisprs

View 1 Replies View Related

Can A Button On A Form Open The Query Builder?

Oct 2, 2004

Hi

I'm not sure if this is a dumb question or not but is it possible for me to have a button on a form that will open the Query Builder?

I have a form that has 3 buttons on it - 1 to access records, 1 to access reports and another which I would like to open the Query Builder when clicked. The database will be used by beginners so I've hidden the design view button and also the database window which appears at startup. All that appears when I open my database is the 3-button form which is what I want.

I thought maybe I could save a blank query and then create a macro to open that whenever the button was clicked and stipulate in the macro to change the view to design view but that didn't work.

Thanks to any help or advice anyone can give and sorry if it turns out to be a really stupid simple solution I've missed (I'm good at that!)

View 1 Replies View Related

Forms :: Open A Detail Form From A Query

Jul 17, 2013

I am a novice ACCESS user, so my questions may be elementary. In Access 2007, I have a query that presents the user with a list of the contacts he/she is approved to access. I want the user to be able to "drill down" to the detail form for a specific contact by double clicking on his last name, but I have not been able to find a property sheet for the last name field in the query to which I can apply the code.

View 14 Replies View Related

Forms :: Query Open In Form View

Mar 23, 2013

I have a form for data entry into my main table. Some records are correct, but some I need to come back to later and correct.

So I have a button on the form to run the Query which works fine. But it opens in a new "Data Sheet View".

Can I make it open in the original form so I can edit the queried data?

View 3 Replies View Related

Query Using Field From Current Open Form Using VBA Function

Oct 23, 2005

I am trying to resolve an issue of being able to use a query from many different forms where the query is dependent on the date selected in the current open form. Right now it calls the function getDate() which works fine. Unfortunatly the function is called before the form is fully loaded and the control I want to pass has no value/doesn't exist yet and I get a
"Runtime error 13 Type-Mismatch"

Here is the function code:

Function getDate() As String

If fIsLoaded("F_SupplierData") Then
getDate = Form_F_SupplierData.txtDate
Else
getDate = "01/01/1901"
End If

End Function

Function fIsLoaded(ByVal strFormName As String) As Integer
'Returns a 0 if form is not open or a -1 if Open
If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> 0 Then
If Forms(strFormName).CurrentView <> 0 Then
fIsLoaded = True
End If
End If
End Function


Is there a way to detect the state of the text field itself (if it is open, closed, dirty)? Or if anyone has a better way to tie a query to multiple forms?

View 5 Replies View Related







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