Passing Focus From A Pop Up Form Back To Mainform

Oct 1, 2005

I have a form for entering data and to aid people inputting data into a text box I would like a pop up form to appear to enable them to refresh their memories as it were with some information. I was going to use the got focus event of the text box to open the popup but how do i then pass the focus back to the main form and text box without triggering the event again

on the flip side I would like to use the lost focus event to close the sub form as well.

any suggestions greatfully received.

Have a Great Weekend, one and all


Dave

View Replies


ADVERTISEMENT

Forms :: Passing A Value Back To A Form

Oct 19, 2013

How do I pass back a value to the calling form (i.e. 'FormA') from a form that is called (i.e. 'FormB').

'FormB' code
stFormName = "FormB"
DoCmd.OpenForm stFormName, acNormal, , , , acWindowNormal, strValue
Msgbox strValue (This is the returned value
'FormB' code
strValue = 'This is the passing value'

View 4 Replies View Related

Toggle Button, Focus, Switching Back And Forth

Feb 6, 2006

Here's a little design problem, all of my VB script works fine, it's just a design problem:

Toggle Button (onClick) {
if pressed in, unlock protected field, pass focus to protected field
else (if not pressed in), lock protected field
}

Protected Field (lostFocus){
When Focus is lost, protect field then reset toggle button
}
See, there's no way that I know of for Access to tell what field has focus at any given moment. It lies inert until an event fires off then it responds. You can't wake Access up and tell it to go do something. So, Protected Field has to lock itself when it loses focus.

Here's the problem. If a user unlocks the field but then decides not to make a change and clicks the toggle again to lock the field, first Access fires the script to protect the field (locking it), then it resets the toggle button, then it registers the toggle button click which unlocks the field. See the problem? If the user changes their mind about changing the field and then tries to lock the field, it ends up unlocked. I need something that will work whether the user is good about it or whether the user is in a rush and forgets about it.

View 2 Replies View Related

Modules & VBA :: Set Focus Back To Access Application

Nov 25, 2013

In my VBA I open the default browser using the following code.

Application.FollowHyperlink "http://www.google.com", , False

Right after opening the browser I would like Focus to go back to Access.

How can I do this?

View 4 Replies View Related

Forms :: Reset Value Back To Previous Value If Not Valid And Then Change Focus To Another Control

Oct 21, 2013

I have an unbound form with a combobox which needs to be validated before the control is updated.In the Before Update event I check that the value is valid and need to reset the value back to the previous value if not valid and then change focus to another control.I thought that the following code would work but the selected value remains in the control and I cannot move the focus to another control.

Code:
Private Sub cboYears_BeforeUpdate(Cancel As Integer)
Dim dteNewDate As Date
dteNewDate = DateSerial(Val(Me.cboYears), Month(Me.txtCalendarHeading), 1)

[code]....

View 7 Replies View Related

Put Password Protect On One Form From On Click Command From Mainform.

Nov 4, 2004

I'm new in access world. please help. I have many forms that control by On click command from the main form. One of the form (which is Calendar form), I like to have password protect in away that only the right ID or password would have access to edit this Calendar, If not users can only view it. Is this possible?, if it is can you please provide some code for me...Thanks in advance..

View 1 Replies View Related

Forms :: Setting Focus To Control On Single Form Side Of Split Form

Jun 24, 2013

When I right click a row on the data sheet side of a split form an select "New Record" I want the curser to go to the first field on the single record side. I've placed this in the OnCurrent but it did no good.

Code:

If Me.NewRecord Then
Me!Descrfiption.SetFocus.
End If

Any way to set the focus to the single form Side of a split form?

View 4 Replies View Related

Set Focus On Form

Jan 28, 2005

I have a form, and when it opens it has focus on a box i dont want it to focus on

How do i change which box it has focus on when it is opened?

View 3 Replies View Related

Focus On A Form

May 26, 2005

How do i choose the field i want my focus to be on when a form i opened?

View 1 Replies View Related

Forms :: Button In Popup Form - Set Focus To Another Form?

Jan 28, 2015

How can I make a button in a pop-up form to send enter key to a text box in another form? Do I need to set focus to the other form first? And how?

View 1 Replies View Related

Sub Form Steals Focus

Apr 14, 2006

Hi, this is frustrating, and a little complicated, so I'll try and explain it as best I can..

I have a form with two sub forms.

The main form "fmMain" contains a list of species. the subform which is causeing me the problems lists loci specific to each species. The user can search by a species or locus and resrict the list accordingly.

Now, here is the problem. The form is too large for my screen, so I have some scroll bars on fmMain. However, whenever the user performs some kind of search the focus shifts to the subform (I guess), causing the screen to scroll to the middle. From here you can't see the species info, and after each navigation the user has to scroll back up again. It's frustrating having to continually scroll around the screen.

Is there anything that can be done to stop the focus shifting around? I'd rather that when the user performed some action the screen just simply didn't move.

Cheers - sorry for the monster post! (hope it all makes sense)

View 6 Replies View Related

Set Focus On A Form With 4 Subforms

Jun 10, 2005

My main form has four command buttons that when clicked will make visible one of four subforms.

I can switch freely about the subforms by clicking on each of the buttons. However, when I place the cursor in a subform(and thus give it Focus), and then attempt to select another button to open another subform, I get the dreaded "can't hide a control that has the focus" error message.

What type of code should I use and where exactly should I be putting it?

I've tried setting focus to another subform in the OnClick event of my buttons, but that doesn't seem to be working.

View 2 Replies View Related

Form Focus Highlight NOT

Jul 7, 2005

How do I turn off the highlight feature when a control on a form obtains focus?
Fen

View 2 Replies View Related

Add A Record To A Sub Form Without Focus

Sep 11, 2006

Does anyone know how I can add a record to a subform that is in data sheet view with out giving the subform focus? I have tried the docmd.gotorecord but I keep getting an error that the form is not open. If i set focus to the subform and then use the docmd.gotorecord it works fine but I do not want to set focus to the sub form

View 1 Replies View Related

Forms :: Set Focus To Sub Form?

Sep 14, 2014

On a main form I have 2 sub forms. On the main form I have a command button that asks how many guests in a booking and depending on the response populates the subform with Guest Names. However it will only do this if I click on the subform and then click the command button.

I want to include some code that sits behind the command button on the main form that will duplicate the otherwise manual selecting of the sub form. And I am thinking this is a SetFocus procedure.

I have tried this code;
[Forms]![Booking].[SubForm1].SetFocus
where Booking is the name of the form. I do not know whether the Subform is #1

View 2 Replies View Related

Set Focus When Pop Up Form Closes

Nov 14, 2014

I am trying to set the focus back to page 1 of TabCt186 when pop up form frmEditWorkItem closes on clicking a command button.

I have been trying with this line of code but keep getting asked for an object required.

Forms!frmReactiveTracker!TabCtl86.Pages.Item(1).Se tFocus

View 4 Replies View Related

Modules & VBA :: Passing Values Of Selected Items From First Form Until Third Form

Aug 12, 2013

I would like passing values from first form until third form.

In the first form I have a list box after selecting items (For each selected item in first form I have 4 values) and pressing button (or right click of mouse) the second form will be open, then in the second form I have 2 option (inserting, deleting), when I select inserting or deleting in the second form, third form will be open, in the third form there is a "OK" button, when I press that, passed values from first form will be used for inserting or deleting records to the table.

View 4 Replies View Related

Setting Focus On A Tabbed Form

Oct 12, 2006

What is the syntax for defining the tab that has focus when a tabbed form is opened under various situations?

View 2 Replies View Related

Forms :: How To Capture SSN From First Form To Use As Focus For Second Form

Jul 22, 2013

I have two forms that have a unique field (SSN).As I'm working in one form, I want to be able to pull up the other form (which isn't a problem). On the second form pulled up, I want the record to match the first form (SSN) - this is the problem.

I believe SetFocus is what I need to use but I don't know how to capture the SSN from the first form to use as the focus for the second form.

View 4 Replies View Related

Passing Data From Child Form, To The Original Form

Dec 8, 2007

Hi All,

I'm not sure if this should go in here or in VB Programming, because it's to do with an Access Database but it's VBA code.
But I understand that VBA and VB are different in the way they work.

I think this may have been looked at before, but I'm not very good at using the search function. I've looked on google, but all I've seen doesn't seem to be for my use, so I came here as recommended by "RadioActive Frog" who I believe is a member here.


Right, basically, I am writing an Access database for my company's ordering system.

I have a form called "Enquiry" which has many tabs, one of these is the "client" tab in in here are many fields:

Firstname
Surname
Company
Addressline1
Addressline2
Town
County
Postcode
Phones
Fax
AltMobile
Email
ContactType

Now, there is an option to enter a new client or search the database for an existing client and it is basically the "new client" which I'm having issue with at the moment.

Basically, clicking the button "New Client" opens another form called "Client". Here, the user enters the data into fields which are the same as above (but on this contact form).

When done, they click a button called "Save and Close" which then asks the user if they want to paste their entered data into the original main "Enquiry" form.

It's this last bit, the transferring of this data I can't get my head around and would be incredibly greatful for help with.

My Code is below:

Code:Private Sub Save_Click()On Error GoTo Err_Save_Click ' On clicking save, a dialogue box will open asking if you want to paste this data ' into the enquiry form. Clicking yes will do this. Clicking no will just close the box 'declare intpress as an integer Dim SavePress As Integer 'Save Command DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 'when save and paste is clicked, ask if the information should be pasted into the form or not SavePress = MsgBox("Would you like to paste this Contact Information into the Enquiry Form?", vbQuestion + vbYesNo, "Paste details") If SavePress = 6 Then 'If the enquiry form was the form which initiated the cotact form, then copy and paste 'the informtion into the enquiry form and the close the form 'If "Enquiry" = Me.OpenArgs Then <------ I have decided not to use this, as it doesn't seem to work. (I'm probably not using it correctly) Enquiry!FIRSTNAME = Me.FIRSTNAME Enquiry!SURNAME = Me.SURNAME Enquiry!COMPANY = Me.COMPANY Enquiry!CATEGORY = Me.CATEGORY Enquiry!ADDRESSLINE1 = Me.ADDRESSLINE1 Enquiry!ADDRESSLINE2 = Me.ADDRESSLINE2 Enquiry!TOWN = Me.TOWN Enquiry!COUNTY = Me.COUNTY Enquiry!POSTCODE = Me.POSTCODE Enquiry!PHONES = Me.PHONES Enquiry!ALTMOBILE = Me.ALTMOBILE Enquiry!EMAIL = Me.EMAIL DoCmd.Close acForm, "Contact" Else DoCmd.Close acForm, "Contact" End If Exit_Save_Click: Exit Sub

But It's not working. It's giving an error saying "Compile Error: Variable not defined" and it highlights the word which I've mad RED in the code above. Now, I tried changing the exclamation for a fullstop, and I also tried writing "Form.Enquiry.FIRSTNAME" (and also with exclamation marks). None have given a working result.


I'll try and get some print screens too for more visibleness (new made-up word there) so you can see what I mean.


Blessings,
Si


Edit: here are a couple of print screens:

1. The Client tab/page of the main enquiry form:

http://i6.photobucket.com/albums/y218/Mr_Si/Enquiry.jpg


2. The Client Details form, which opens as a result of pressing the "New Client" button in the main enquiry form (shown in the background):

http://i6.photobucket.com/albums/y218/Mr_Si/Client.jpg


Argh! I forgot I couldn't post links to URLs

View 1 Replies View Related

Forms :: Passing Values From One Form To A New Record In Another Form

Oct 25, 2013

Have one form that contains values AssociatedProject and AssociatedRelease that need to be passed onto another form that opens with a new record. Have tried different variations based on what I read here and couldn't get them to work.

Initial form - frm_ViewList contains the values that I need to pass on and has a "Add" button to bring up the new form that also creates a new record. The add button contains the following:

Dim stDocName As String
MyAssociatedProject = Me.AssociatedProject
MyAssociatedRelease = Me.AssociatedRelease
stDocName = "Frm:ManageQuestionsAnswersProc"
DoCmd.OpenForm stDocName, acNormal
DoCmd.GoToRecord , , acNewRec

Then in the second form Frm:ManageQuestionsAnswersProc the following code is contained in the Before Insert:

Me.AssociatedProject = MyAssociatedProject
Me.AssociatedRelease = MyAssociatedRelease

View 3 Replies View Related

Passing Value To A Sub Form

Feb 26, 2005

Hello,

I have a combo box on a main form and one on a subForm (DataSheet View)...

I want the value in the main_combo to populate the sub_combo for every record in the subform.

I think the code would look like this, but I cant get it to work?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Private Sub MAIN_DUNS_AfterUpdate(Cancel As Integer)

Me.CLIENT_DEAL.SUB_DUNS = Me.MAIN_DUNS.Value

End Sub

MAIN_DUNS= Combo on main form
SUB_DUNS= Combo on sub form
CLIENT_DEAL= Sub Form
DEAL_INFORMATION=Main Form
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Any Ideas on how to get this to work correctly??

View 1 Replies View Related

Forms :: Field Focus In Modal Form

Dec 29, 2014

How do you set the focus on the first field in a modal form when it opens?

View 3 Replies View Related

Forms :: Setting Form Focus Properly?

Jul 10, 2014

I have a Main Form with a tab control. On each of the six tabs is a SubForm that takes up the entire tab. So basically I have a tabbed interface for my forms, just with a bit more control over the layout than if I just opened the forms separately in the Access window.

Anyway, on one of those subforms is a button. When you click it, it opens a separate form in a pop-up window, which is used to find a specific record. Once that record is found, you can click another button, and the idea is that this pop-up window closes, and you return to the underlying form, which jumps to the record you selected.

So far so good. Now, if I am working on my program in Access, and I open that subform's source form separately in its own tab, click the icon to open the record finding form, find a record, and then click the button to load that record, the following code runs, and it runs flawlessly - closing the pop-up window, and passing the information back to the main form which displays the proper record:

Quote:

Private Sub ViewRecord_Click()
Dim RecordID As Integer
RecordID = Me.ID
DoCmd.OpenForm "CDLExam", , , "ID = " & RecordID
DoCmd.Close acForm, "CDLExamCONT", acSaveNo
End Sub

Where my program falls apart is that, in actual use, this form is not open on its own. It's open as a subform on one tab of a tab control on a Main Form. So the third line of code falls apart. Access thinks I want to open CDLExam separately, but it can't because it's already open in the subform, so instead I just end up back at the main window like I want, but the form fails to move to the proper record. Basically, line 3 just doesn't do anything.

How can I make this work? I tried replacing "CDLExam" with the name of the main window, but then it tries to move to the record in the main window, which throws an error as the main window doesn't even have a record source attached to it.

how to refer to the SUBFORM which has CDLExam open, and tell THAT to move to the proper record.

View 14 Replies View Related

Passing A Variable From One Form To Another

Mar 5, 2008

how can i pass a variable from one form to another

this works fine
Tracking_Number = Forms("Main").Control("mytext")

but if "mytext" was in vb (rather than from a text box as shown above) how can i do this

View 4 Replies View Related

Passing Value From Form To Report

Jun 20, 2007

Hello,

I have made one form for report purpose. When I enter Start date and End date, I get report of the date range. What I am looking that I want to print the start date and end date in my report. How can I reference date text box in my report?

thanks

mithani

View 7 Replies View Related







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