Set Focus To Subform But Do Not Activate
Sep 28, 2006
i won't go into details except i am doing databases for cemeteries - very complicated
example
i have come across two people who have the same name, date of death, buried in the same grave on the same day but are not related and must have seperate records!!
my main table has 6 primary keys. [even then i have 2 duplicates who are not related]
anyway one of the problems is this
i have a main form with 2 subforms. the main form is unbounded. i need to copy information from 1 of 4 queries run by the main form [QBF] to one of the subforms. i don't know which query untill i view the data.
when i know which one, i press a command button which copies the information to one of the subforms. when i repeat the actions above instead on the new query data going into a new record on the subform it overwrites the existing data instead of pasting it into a new record.
i have tried setfocus command - this works only if i click on the subform and activate it [this defeats the object of the command as i might just as well click in a new record box on the subform].
in essence i do not need to activate this subform at all. i just need to check if a record exists and if it does goto a new record [again this works only if i physically click on the form]
any ideas how i can force the cursor to goto a new record without physically clicking on the subform??
thanks
View Replies
ADVERTISEMENT
Mar 21, 2015
I have two forms one simple and another sub form located in simple form and connected to query where query has parameters, while opening the simple form the sub form require the parameter values. Question is here how I can make the sub form like when I open the simple form the sub form must be disabled (not request me for parameter values) and make a button in simple form to activate the sub form and then request me the parameter values.
View 1 Replies
View Related
Jan 2, 2007
I have 4 nested forms:
DataEntryMaster
DataEntryMainSub (subform on DataEntryMaster)
DataEntrySub2 (subform on DataEntryMainSub)
DataEntrySub3(subform on DataEntrySub2)
In the AfterUpdate even of DataEntrySub2, I have code that checks to make sure the field on DataEntrySub3 (it has only one field) has been filled in. If not, I want to set the focus to DataEntrySub3.
The code in the DataEntrySub2 afterupdate event:
if isnull(me!dataentrysub3.productbarcode then
msgbox "You must enter a product barcode!"
forms!dataentrymaster!dataentrymainsubform!setfocu s
forms!dataentrymaster!dataentrymainsubform!dataent rysub2.setfocus
forms!dataentrymaster!dataentrymainsubform!dataent rysub2!dataentrysub3.setfocus
end if
I've used this most-wordy syntax because I couldn't get the shorter syntax (eg, me.dataentrysub3.setfocus) to work at all. However, this STILL doesn't work.
What's really puzzling is that if I run those exact same 3 setfocus statements from the immediate pane, they work fine. But in the afterupdate event, my focus always ends up on a control in dataentrysub2.
Any ideas???
View 1 Replies
View Related
Mar 9, 2005
Well, the title says it all really. After I click into the subform and type something in a text box, the focus will not return to the parent form, via mouse or tab. I can't even switch the form back into design view, it appears to be totally locked. Has anyone run into this before?
View 4 Replies
View Related
Mar 20, 2014
If i open a form with a sub form on can i open it so that the focus go directly to a control on a sub form.I have tried to do it with a macro on the on open event to go to control but it comes up that the control don't exists on the sub form.i am using access 2010.
View 6 Replies
View Related
Aug 25, 2004
When I click on my subform after entering some data in the primary form, I get this error message:
"The Microsoft Jet database engine can't find a record in the table <name> with key matching field(s) <name>. (Error 3101)"
This is because I have not filled in a ItemCode, a combobox, on the parent form and ItemCode is part of a one-to-many relationship that involves automatic filling in of other fields such as ItemDesc, UnitPrice, etc. How do I code the validation that handles such an error?
Thanks in advance,
Swee
View 4 Replies
View Related
Mar 7, 2014
I have a form with a subform on it. The subform has subforms. I need to set the focus on a control on one of the subforms. Here is what I am using.
START OF CODE
Forms!frmMain!frmMainSub.Form.frmContactLog.SetFoc us
Forms!frmMain!frmMainSub.Form.frmContactLog.Contac tMethod.SetFocus
END OF CODE
I use Code 1 to get to the third level. Code 1 works.
Code 1
Forms!frmMain!frmMainSub.Form.frmContactLog.SetFoc us
When I add the second line, Code 2, it doesn't work. I get the message "Run-time error 438: Object doesn't support this property or method."
Code 2
Forms!frmMain!frmMainSub.Form.frmContactLog.Contac tMethod.SetFocus
View 2 Replies
View Related
Jan 21, 2015
I have a single main form with a datasheet subform. When I scroll through the records shon in the main form, each has a different set of child records shown in the subform.
I want the focus to be on the last record of the subform each time.
On the main form, I have a button and this code
Code:
Private Sub cmdLast_Click()
Me.frmRevisionsSub.Requery
Me.frmRevisionsSub.SetFocus
Me.frmRevisionsSub.Form.txtRevTag.SetFocus
DoCmd.GoToRecord , , acLast
End Sub
which works perfectly, when I click the button.
If I call this code from main form's OnCurrent, focus remains on the first line of the subform instead of going to the the last. I have an inkling that it has to do with when the requery of the subform takes place, when I scroll through the records on the main form.
View 1 Replies
View Related
Jan 2, 2014
I have a form with a subform which is sized to show several records at the same time. If Record A has the focus, and I click anywhere in Record B, then Record B gets the focus, as expected. ... Except if I click on an Image field in Record B, when the focus stays on Record A.
How I can force it to set the focus to the other record ? I don't think this can be done with Events handlers, as they need to have the focus set first.
View 5 Replies
View Related
Apr 22, 2015
Is it possible for an image control to change to a different picture on a form when focus changes to a different record on a subform? I am developing a simple database to record my ever growing collection of TV shows. The form that I use to view my TV show records has an image control on it, I previously had a single image for the entire series (box art for first season). I now want that image control to change to a different picture when the focus changes to a different record on the subform. i.e. when the focus changes from the first season on the subform to the second season; the picture on the main form changes with it.
View 7 Replies
View Related
Dec 17, 2014
I have a form, with a subform,
When a user selects a record from the subform i use this to view the record in the main form
Private Sub Txt_Support_Name_Click()
DoCmd.ApplyFilter , "ID =" & Me.ID
End Sub
However when i select the record from the subform, it populates the form as required, however then the top record of the subform is highlighted.
Any way to either - highlight nothing, or highlight the selected row?
View 4 Replies
View Related
Jun 29, 2014
I have a form that I created that has a tab control. When the form loads, it automatically sets the focus to a field in the subform. This wouldn't be a problem, except when it does it hides the tabs at the top of the form so I have to go and scroll back up every time I click a tab so that I can see the tabs. Is there a way to adjust this? I have tried hiding a field and setting the focus to it and that didn't work. I also tried setting the focus to the actual tab, but that also did not work.
View 8 Replies
View Related
Nov 19, 2014
I am trying to highligh a subform textbox a yellow color on focus. However it is highlighting every textbox in that field as it is a continuous form therefore they are all named ThisCount.
Is there a way to highlight just the specific textbox that I am in. I have tried.
Code:
Me.ThisCount.BorderColor =RGB(255, 215, 0) 'gold
Me.ThisCount.BorderWidth =3
and tried
Code:
Dim ctlCurrentControl As Control
Dim strControlName As String
Set ctlCurrentControl = Screen.ActiveControl
strControlName = ctlCurrentControl.Name
Set ctlCurrentControl = Screen.ActiveControl
ctlCurrentControl.BorderColor = RGB(255, 215, 0) 'gold
ctlCurrentControl.BorderWidth = 3
View 8 Replies
View Related
Dec 3, 2007
I want to edit a report i Access. How do I activate the Field list so I can choose fields to insert into my report? It is gray.
View 3 Replies
View Related
Feb 25, 2014
I have a sub form that hase multiple records. What I would like to do is if my catagory field = "(1) Constrution" the deactivate 'DC to Apply', got that to work BUT it does it for all of the record..Notice in the pic that the first record = "(1) Constrution" and id deactivates ALL of the "DC to Apply"
Here is my code
Private Sub Category_AfterUpdate()
If Me.Catagory = "(1) Construction" Then
Me.DC_to_Apply.Enabled = False
Else
[code]....
View 14 Replies
View Related
Aug 19, 2015
I am currently stuck on set focus property. I have a main from with nested subform. I am trying to move the focus from last field of the subform to another field on the main form.
Customers(mfrm)....>Addresses(sfrm)...>Orders(sfrm Add)......>OrdDetails(sfrmOrders)
Now I have a field name [Securedesign] in frmOrderdetails and I want the tab order to navigate to field [CustomerID] in frmAddresses which is a subform to frmCustomers.
View 2 Replies
View Related
Nov 23, 2005
Hi, im working on my school project for A2.
When the user clicks on say; the customer ID dropdown menu, i want the label text on the right of it to get darker (make it more visible). How can i do this?
(i have attached a picture of my form)
thanks, Robin
View 2 Replies
View Related
Feb 23, 2006
Per the instructions detailed here...
http://www.fontstuff.com/access/acctut08.htm
...I created a parameter query in the form of a drop down box that uses a
command button to produce a query.
The code is as follows:
Private Sub cmdCreateReport_Click()
DoCmd.OpenQuery "qryUIRFollowUp", acViewNormal, acEdit
DoCmd.Close acForm, "frmOpenUIRLookUp"
End Sub
This produces the data I need in datasheet view. I want to use this same
data to populate a form I've created that will use the above data as a
springboard to add more data to another table (also connected to my form).
So what code do I need to add to the above so that along with producing the
data the command jumps right to the next step and feeds this data
into the form and then displays that form?
Thanks for the help,
David
View 4 Replies
View Related
Sep 16, 2014
I have a Child Report with underlaying records from a SELECT DISTINCT.
I prints records of prices, I need to show "some_text" if the price is "0".
Which event should I use?
I tried ChildReport On_Activate but could not pull it off.
View 2 Replies
View Related
Jul 21, 2015
Access 2007, Sql Server 2008 R2. Problem with refresh.
Form 1, (Single Form) Parent Form, contains Property Year Detail data. PK = PropYrDetID. This is a SINGLE FORM
Form 2, (Single Form) Child form, contains land square footage data from multiple records. PK = SPYDID FK = PropYrDetID. This is a SINGLE FORM.
The code below executes every time Form 1 opens, activates or whatever. The reason is that data in Form 2 changes frequently. Thus every time Form 1 opens the end user will see the latest data.
"Form 1" receives a series of values that it obtains from VBA code that runs when it opens or activates.
"Form 2" has the data being summarized in Form 1.
All of the code and queries below run fine and return the correct values from Form 2 to Form 1. My problem is Refresh on Form 1.
I've tried the code in the On Current, On Activate, On Load of Form 1. Mostly the data shows up in Form 1. Other times parts of the data are left out. I have to hit F5 or close and reopen the form, and then the data appears. When I don't see data on Form 1, I check the underlying table and the correct data exists. I don't know how to achieve a 100% refresh success. I have tried me.refresh and different Events all over the place.
All of the code below runs when Form 1 opens. Queries are fine, Equations are fine, Tests run fine. It's the results showing up that I am having the problem with.
I don't think the issue is with the code but with the Refresh. Here it is for your review.
The term "Equations" is the customers. There are 5 equations. Some have a series of tests after the Equation to determine the result.
Code:
Private Sub Form_Activate()
Dim rs As Variant
Dim varAOProp As Variant
Dim varAOIni As Variant
Dim varAOCert As Variant
Dim varBORIni As Variant
Dim varBORFinal As Variant
[Code] ....
View 5 Replies
View Related
Jan 26, 2007
Hi Folks.
I'm having a problem with ODBC in Access.
For some unknown reason, when I click Get External Data > Link Tables
the ODBC Dialog box doesn't appear.
I have reinstalled Access and ODBC from the MDAC.
Still the ODBC dialog will not appear.
The funny thing is that existing links to my SQL Server database open fine and display the data.
Has anyone experienced this issue and what was the fix.
Thanks.
View 8 Replies
View Related
May 2, 2013
I have a button on my form, that runs a series of queries then closes the form. It works great!!
How can I get the MsgBox feature to continue with all commands or cancel and close the form?
Here is my code without message box action
Private Sub AcceptChanges_Click()
DoCmd.SetWarnings False
Forms!SelectCustomerNewCustomerF!MergedRecordsF!CustomerID = Me.SecondID
Forms!SelectCustomerNewCustomerF!MergedRecordsF!MergedTo = Me.IDprimary
Forms!SelectPrimaryNewCustomerF!MergedRecordsF!UserID = Me.UserIdChange
DoEvents
[Code] ....
All of these actions work great, and do not need to be modified. it is just a msg box button to continue or cancel and close the form.
View 2 Replies
View Related
Aug 12, 2014
I am trying to make a form where the user can check/uncheck query criteria via several check boxes. The idea is that the user can start with many criteria and then deselect criteria if the search does not return enough results.
I have been setting up several queries and thought I would combine them in a "Master Query", since I thought it may be easier to deal with each criterion and the respective switch this way.
Lets say we run a hairdresser.
I have a field in the form that allows me to select clients. This is also used in the query. Works fine. Now to the hard part.
Example 1:
Each customer has a budget to spend on haircuts.
Each hairdresser offers haircuts from $x to $y.
The query should return all hairdressers that are appropriate for the budget of the selected customer.
There should be a yes/no button on the form to ignore or use this criterion.
Example 2 (this completely threw me off):
Each customer has a set of preferred services from a table (e.g. cutting,washing, coloring).
Each hairdresser offers certain services also based on this table (e.g. cutting,washing, coloring, drying).
The customer and hairdresser table use the services table and a multi combo box to select the services.
The query should return only hairdressers that offer some or none of the services wanted by the client.
Again, there should be a services yes/no button on the form to either ignore or include this criterion.
To clarify, the hard part for me is the query. I am fine with setting up the tables and the form. Just not sure how to implement something like "IF (ServicesCheckBox = -1, 'then use service criterion', 'ignore service criterion')".
View 7 Replies
View Related
May 6, 2005
I have a mainform (f1) and a subform (f2). The subform normally is not visible ([Fomrs]![f1]![f2].visible = Fasle). When I click on a command button on the main form, the subform wiill show up on the main form ([Fomrs]![f1]![f2].visible = True). There is another command button on the subform. When I click on the button, it opens up a third form (f3). The relationship between f1 and f2 is master-child, and the relationship between f2 and f3 is also master-child.
After I open the third form, I want to close (hide) the subform (f2), but I got an error saying that I can not "hide an object that is in focus".
Do you know any trick to do that? Thanks a lot.
Zoo
View 1 Replies
View Related
Aug 18, 2014
I have a main form that holds a tab control with a number of sub forms. One of these subforms has a pop up form for adding new records to it. After closing this pop up form I would like to initate code on the sub form where the new record now will appear. One of the things I like to do is simply to set focus to the record the user just added.
My problem is that I cannot seem to get any event to trigger in this setting (bben trying more or less all). If I understand things right the fact that I am using a pop up form and the fact that I am using a tab control both seem to interfer with the Activate event and making it passive.
How I can trigger code on the sub form (after closing the "Add New" pop up form)?
View 6 Replies
View Related
Mar 24, 2005
I have several forms and subforms that display data, but are not used for data entry. The first textbox on every form gets the focus on open. I'm sure I've seen some way to open the form with no focus on any control!
Can someone help me remember?
Thanks,
Sup
View 3 Replies
View Related