Open Form Function

Feb 3, 2006

hello,

I use macros to open forms (with a query as filters).
I would like to replace macros with code. Any help?

This is what I have for the Open Form macro:
Macro named: OpenMaster
Form Name: Master
View: Form
Filter Name: qryMaster
viewMode: Normal

Thanks.

View Replies


ADVERTISEMENT

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

Modules & VBA :: Shell Function To Open Calculator

Dec 17, 2014

I want to open the Calculator by clicking a command button (using the On Click event).

I have tried the code below but can't get it working. What do I need to change?

Private Sub Command7_Click()
Dim RetVal As Integer
RetVal = Shell("C:Windowscalc.exe", 1)
End Sub

View 2 Replies View Related

Forms :: How To Open A Specific File Using Search Function In Access 2003

Dec 5, 2014

I have a access 2003 database, and i am wondering if i can't setup a search function in a form that will open a file in windows explorer?

What i would like to do is have a test box that i enter in a number for example: 1234 then have a button named "Search" hit that button and it opens a corresponding file in windows explorer named 1234, or just opens that folder directly..

View 14 Replies View Related

Forms :: When Open A Form / Want To Open Another From At Same

Jan 14, 2015

when i open a form i want to open another frm at the same time. i have a main form with some buttons in it. when i click on a button and a form opens then i am not able to click on a button to open other forms from the main form.

View 2 Replies View Related

Closing An Open Form From Another Form That Is Open

Dec 17, 2004

Is there a way to close a form that is open from another form that has the focus. I tried using the Unload event, but I received an error message "Cant load or unload the object". I would appreciate any help!

View 1 Replies View Related

Forms :: Button In Form To Open Different Form And Chose A Customer Based On Last Form

Mar 26, 2013

Basically I have a Customer Form, which I have a New party button on it,this button opens up the party form to a new party, what I would like it to do is open up a new party but make the new party for the customer I had selected in the previous form.I have tried the GoTo macro's but cannot seem to get it to work.

I am thinking on clicking the button it will need to get the Customer ID, and then open the party form, create new party, and paste in the Customer ID, which then updates the Name - Date - Address - Company Fields.

View 5 Replies View Related

After Open Open Another Form

Jul 26, 2005

I want to open another form automatically when an initial form opens, both are non popup) I have tried open and load events - but still the calling form appears on top of the called form.

How do I get the two forms to open form 1 and then form 2?

Also I cannot use the timer event as this is doing something else.

Thanks

View 2 Replies View Related

Forms :: Open Blank Form Based On Value In Text Field In Main Form

Jun 6, 2013

I have one table containing name of restaurant with its address etc. Then i created another table to list out the restaurant workers names and details. Just as an example,

Table:Restaurant
Restaurant name
Address line 1
Address line 2
Restaurant #
Website

Table:StaffContact
Staff Role
Name
speciality
email
phone

I have the main form that has all the restaurant details only. And i have another form containing the Staff information. Please note the two table have a relation and it works well.

Now to make it user friendly(basically easier for the lazy ones), I dragged the staff contact form on to my main form and displayed it as a datasheet(basically a sub form).

Now, my boss does not want users to add/delete on this sub form(datasheet). So,he wants me to create buttons to open new record of staff for each restaurant(new form)

My issue is with opening a new record to enter a new person to the staff list and give them a role as well in form view.The new form has

So i ran a Macro, with open form with Where condition

Code:
[Staffcontact]![Rest Name]=[Forms]![MainForm]![RestaurantName]

But, it does not work .

View 2 Replies View Related

Forms :: Continuous Form With Command Button On Each Record To Open Another Form

Jul 30, 2014

I have a continuous form in which I put a command button for each record called "detail". I would like to click on the "detail" button and make it open another form containing all (and only) the info on this record.

At first I refused to use an "id" to link both forms, but finally I added the "id" in the table... however still does not work.

continuous form: "04 - GASTOS_BUSQUEDA"
id field on continuous form: "Gastid"

pop-up (details) form: "GASTOS_EDITAR"
id on pop-up (details) form: "editar_id"

This is what I have tried on the "click" properties of the "details" button field (called "btn_editgs"):

1)
DoCmd.OpenForm "GASTOS_EDITAR", acNormal, , "[editar_id] = " & Me.Gastid

2)
DoCmd.OpenForm "GASTOS_EDITAR", , , "[editar_id]=" & Me.Gastid

3)
stLinkCriteria = "[editar_id]=" & Me![Gastid]
DoCmd.OpenForm "GASTOS_EDITAR", , , stLinkCriteria

4)
Private Sub btn_editgs_Click()
On Error GoTo btn_editgs_Click_Err
Dim strWhere As String
strWhere = "[editar_id] = " & Me.Gastid
DoCmd.OpenForm "GASTOS_EDITAR", , , strWhere
btn_editgs_Click_Exit:
Exit Sub
btn_editgs_Click_Err:
MsgBox Error$
Resume btn_editgs_Click_Exit
End Sub

View 9 Replies View Related

General :: Modal Form - Open Concrete Form And Pass Value To Control

Jun 21, 2013

I have modal form - frmZlecenia

I would like to copy one control, then close this form, open concrete form and pass value to control.

My code is

Private Sub Menu_Click()
DoCmd.OpenForm "frmZleceniaMarzenaNawigacjaPD"
Forms!frmZleceniaMarzenaNawigacjaPD.Form!Imie = Me.Imie
Forms!frmZleceniaMarzenaNawigacjaPD.Form!Imie.SetFocus
DoCmd.Close acForm, Me.name
End Sub

The problem is, still opens the previous form, not form "frmZlecenia"

e.g If I open form x then from this form I open my modal form "frmZlecenia" and then I will click "menu" button - now form "x" is open :/, but should be "frmZleceniaMarzenaNawigacjaPD"

There is some way to open concrete form from modal form?

View 1 Replies View Related

Open Form Command Button Fills In Text And Date Fields From Previous Form

Apr 27, 2005

I currently have two forms: frmE_SAFind and frmE_SAOrder

frmE_SAFind shows results from a query including fields [txtIDPO] and [dtmDate]
Example:
IDPO Date
btnOpnFrm 6543 2/1/05
btnOpnFrm 5681 1/1/05

frmE_SAOrder shows order details including [txtIDPO] and [dtmDate]

I have a open form command button set up on [frmE_SAFind] that opens [frmE_SAOrder]. Is it possible for me to modify its properties so that when the open form command button is clicked, the order details in [frmE_SAOrder] will represent the order that the user is selecting via the btnOpnFrm command?

Example: If I click btnOpnFrm for 6543, [frmE_SAOrder] will show me PO 6543 details.

Hopefully I made myself clear enough to understand. Thanks for your help!

View 1 Replies View Related

Forms :: Navigation Form - BrowseTo Command To Open Up A Form In Built-in Subform Module

May 3, 2013

I'm working on the Navigation Form template in Access 2010, which is new to me. It appears that one needs to use the BrowseTo command to open up a form in the built-in subform module. I'm trying to create a couple of buttons where each button opens a form in a different data mode; one in read-only and one in add mode. Here is the syntax I used for read-only:

DoCmd.BrowseTo acBrowseToForm, "frmSales","frmNavigation.NavigationSubform", , ,acFormReadOnly

frmSales is the Sales form I want both of the buttons to open and frmNavigation is the Navigation form. It seems to be ignoring the data mode part at the end however. It only will open in Edit mode. Is there something I'm doing wrong with this command?

View 3 Replies View Related

Forms :: Double Click Record In One Form To Open New Form?

Jan 27, 2014

I am trying to create a proposal log for my company to make things easier to track. I have made a multiple items form to list the proposals. I want to be able to double click the record to open up another form (that i have already created) that shows the information from the proposal table and the proposal details table. So.....

I want to double click the field named "Proposal Name" and have it open up to form i have called "proposals details form".

View 3 Replies View Related

Forms :: Open New Form With Record Data Sorted From Another Form?

Apr 2, 2014

I have a main form[frmResearchNotes] with combo box controls that filters a query populating [subfrmNotelist] containing several records from the filtered query. From there, I double click on a field within one of the remaining records, [CompanyName] for example, and it opens the new form[frmNoteDetail]. The problem is that second form is not displaying that selected record. The second form's record source has been set to the same query so when it loads, it displays the same info but it's displaying the 1st record out of the entire filtered list, not the record I clicked on in that list.

I figured I could use the strWhere function to copy the record I selected in the event procedure and then open the new form with those details. Not sure how to actually do this with VBA or if it's even the correct approach.

View 14 Replies View Related

Forms :: Open Form Directly Inside Navigation Form?

Oct 28, 2013

I would like to know if it's possible to open an specific subform inside a navigation form using an event.

I also need to to this using macros ( really can't use vba in this project =/)

Form example:

the main form has "nav_opt1", "nav_opt2", "nav_opt3"

By double clicking a record in "nav_opt1", it will open "nav_opt2" with some filters (but all in the same window), as if I was just browsing through the navigation forms usually.

View 1 Replies View Related

Creating Form To Target Current Record Open In Another Form

Apr 17, 2014

I have three objects a Main_Table , ClientDataForm and a MapForm all three share a common ClientID number

From that Main_Table I have created a ClientDataForm form which I enter all Data

From ClientDataForm I wish to create a button on it which runs a Macro that Saves ClientDataForm Record and then populates another form named MapForm with whatever record is currently open in Form One whether a newly created one or previous record.

How would I write this code for that button? Also why I would write it that way?

View 3 Replies View Related

Modules & VBA :: Creating A Function That Counts Records And Use That Function In A Query

Dec 11, 2013

So basically I need making a function that will count the number of records from another table/query based on a field from the current query.

View 2 Replies View Related

Open Previous Form From Current Form Sub Form

May 7, 2005

I have a fault form which the user enters details of a fault. When the fault form is submitted the data is saved in the relevant table and the form is cleared so that the user can enter the next fault. On the fault form i have a subform which displays the faults previously entered by the user. I want the user to be able to click on an entry in the subform and open the orignal fault form and see the data that had been entered. How can i create this functionality??

View 9 Replies View Related

Event From One Form That Opens Another Form: How Do I Open To The Right Record?

Nov 7, 2006

I have code for a button click event. Essentially I have a main table form that I use to enter customer data and info. I also have a button that I use to add that customer to a separate table that I use for special Customers. My code copies all the data I need copied to my other table, so I wont waste space here typing my code that actually copies the data to the new table. What I will list are the two commands I am using after that code, to close the current form (the one with the button) and open the form for entering special customer information (the form to edit data on my other table). It works flawlessly, but when it opens the other form, it opens to the first record. I want to know how to make it open to the record which I was viewing when I clicked the button to copy the data.


DoCmd.OpenForm "Special Customer Data Entry", , , Number = Me.Number
DoCmd.Close acForm, "Customer Data"

View 9 Replies View Related

Open Form Not Adding Record And Use An Add Button On Form

Aug 2, 2006

I have a database with three tables

table 1 (form1)
reference (PK) auto number

table 2 (form2)
Reference (fK)
workbook reference (PK) auto number

Table 3 (sub form within in form2)
Reference (FK)
workbook reference (fK)
data Reference (pk) auto number

Each table is a form that is linked via the keys. On form 1 i have a button that is to open the form2, which it does but every time i open the form a new record is added. Why and how do i prevent this.

Then what i want to do is add a button for a new form on table 2 form but use the same reference as the record as presently displayed. How do i add new record using the same Reference but new workbook Reference?

Thanks is advance

View 1 Replies View Related

Need Code To Open TeacherDetailFrm Form Main Form.

Jun 11, 2007

Hi
I need code to open TeacherDetailFrm form Main form.

I have TeacherStudentSubFr*m on the Mainform, FirstNameTxt on the TeacherStudentSubFr*m, and TeacherDetailFrm.
I need code to open the TeacherDetailFrm By double click on the FirstNameTxt.

I use this code but no data come and query dialog box come.

Private Sub FirstNameTxt_DblCli*ck(Cancel As Integer)
Dim DocSubForm As String
Dim DocText As String
DocSubForm = "TeacherDetailFrm"
'DocText = "[Result]=" & "'" & Me![result] & "'"
DoCmd.OpenForm DocSubForm, , , "[ FirstNameFld ]=forms![TeacherStudentSubFrm]![ FirstNameTxt]"

End Sub


I like to upload the file but no way in this forum

View 2 Replies View Related

Forms :: Open Second Form On Related Field From First Form?

Aug 22, 2013

how to write code to open a second form on the click of a button on the first form and specifically to continue on the record set I am focusing on.

I have 2 tables. The first is tblAccount (fields: AccountID [the PK]; AccountHolder) and the 2nd is tblUser (fields: UserID [the PK]; UserName; AccountID). They are linked so that one account can have multiple users. Each has a respective form; frmAccount and frmUser.

My goal is that once the AccountHolder field has been populated in frmAccount I can click a button to open frmUser with the AccountID field already showing in the form header.

I have managed to do something similar by selecting from a combo box before but I am having trouble making this work after directly populating the AccountHolder field and using an open Form button.

View 2 Replies View Related

Forms :: Open A Form Based On Current Form?

Nov 23, 2014

When I have a form called "SiteForm" open and click a button "NewCalloutButton" I would like it to open up a form called "CalloutFormEntry"

I've done this using

Private Sub cmdOpenDetail_Click()
DoCmd.OpenForm "CalloutFormEntry", , , "CalloutID = " & Me!CalloutID
End Sub

However this brings up all the records linked to the calloutID

What I'm after is to open the CalloutFormEntry from the SiteForm in a dataentry kind of format but to carry over the current SiteID based on which site is open on the SiteForm. That way there's no user error logging callouts to incorrect sites.

View 9 Replies View Related

Forms :: Open A Form With Subform From Separate Form

Oct 23, 2014

I'm trying to open a form with a subform from a separate form. I've never had any issue before, but all of the sudden, the subform doesn't seem to open immediately. I get the error

Code:
Method 'Form' of object '_SubForm' failed.

After that, it opens (subform and all), but some calculated text fields just say "#Name?#"
The only thing I did today was add a command button to that subform.

When I try opening the form (or subform) from the navigation pane, I get

Code:
The expression On Current you entered as the event property setting produced the following error:

A problem occurred while Contracts was communicating with the OLE server or ActiveX Control

When I step through the code, it doesn't reach the On Current event.

View 5 Replies View Related

Form Lookup Function

May 16, 2006

Hi there, please excuse my poor access skills, I've searched the forums but can't really find what I'm looking for......I have two basic tables in my db, one is an inventory listing all the stock in the company, and this is linked to a tracking table, which contains all the different movements for this stock item......this is a simple one to many relationship, what I want to do is lookup the value of the 'In/Out' field in the last tracking record for every item, and set the quantity of that item in the inventory table to 0 or 1 depending on the value......how would i best go about this and where should i put the code.....? Any help is much appreciated.

View 3 Replies View Related







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