Does microsft office access have this function when i select the row from the subform,
the selected data from EmpName, ComputerName & ProductName will automatically fill into my 2 textbox at the top right and the product Name will be another combobox to select product.
Another thing is, Is it possible to do CRUD upon selection in subform?
what kind of tag should i goggle for to answer my question? I tried a lot of different tags aldy but none answers my question.
The short answer is yes. ;) You can do all those things. I well remember the day I realized that I could do anything in MS Access. (now be kind this was the first experience I had in programming)
You can reference Parent controls from subforms with this convention Me.Parent.control
For example if the Parent form has a text box named txtEmployeeId then on the Click event of a text box in the sub form you could have this code.
Me.Parent.txtEmployeeID = Me.txtEmployeeID
You can quickly extend this code to do whatever you need ie.
Me.Parent.txtComputerName = Me.ComputerName
Me.Parent.cboProductName = Me.ProductName
CRUD is a statement used in web development which seems to be where you are coming from. Access is CRUD in many ways (unless you start getting complicated) In the example above, once you navigate off the parent record with the record selector or close the form, the record is saved without any code being written. Once you start playing around with unbound controls then it becomes necessary to write code to save your work.
Related
I have an Access 2010 database set up with using the native Navigation Form interface feature.
Using this very helpful table, I've been able to use vba on multiple ocassions to reference forms throughout my database. However I seem to be having difficulty in this one instance.
On the Navigation form I have a number of main tabs. Clicking on one of the main tabs brings up a number of sub-tabs that have various forms attached to them.
On one of these sub-tabs, I have a main form (main) attached to it. There is a subform (subform1) within that main form containing a control text box (control1). Within subform1 there is another form (subform2) containing an unbound text box (control2) displaying a value that is calculated using a TempVar.
I want to use the AfterUpdate event on control1 to requery subform2 in order to update the calculation in control2, or simply requery control2.
Using Refresh and/or Requery on the AfterUpdate event for control1 does not do anything to control2.
Currently I have a button on subform2 that users can click which refreshes the form and updates the value in control2. The user can also hit F5 and refresh all the forms with the same result.
My goal is to take away the manual aspect and have the AfterUpdate event for control1 to update control2.
Any help would be much appreciated as I haven't been able to find anything online that works and I've been kicking tires at the problem for over a month now.
**** UPDATE **** I did not correctly describe the layout of my forms. subform1 and subform2 are actually both nested under main. subform2 is NOT nested under subform1 as I originally described above.
Wow. Now I feel like an idiot. Tackling my problem again with the update I provided above allowed me to solve it.
All I needed to do was requery subform2 by referencing it this way:
[Forms]![HOME]![NavigationSubform].[Form]![subform2].[Form].Requery
Where "HOME" is the name of my Navigation Form.
For anyone with the same issue that hasn't renamed their Navigation Form I believe the syntax would be:
[Forms]![Navigation Form]![NavigationSubform].[Form]![subform2].[Form].Requery
Thank you to #Erik von Asmuth and #June7 for your patience and help.
Please press here to see my gif that could provide a better understanding of my problem.
As you can see above that it's kinda a problem, but I don't know what to do, so I am hoping that some of you could tell me what and how to do with this. It's my first time to see this " Object variable or With block variable not set" problem...
I don't have any code to show you because I was using the default way to make bound textbox and then using a subform with lots of subform. (See the gif for the idea of the layout)
It's in danish language, but I think this should be a common problem as everywhere in the world, so...
It's in access 2013, in case you was asking.
uhm... If there're any questions, please ask right away.
So you have a subform within a subform and you are receiving an error when trying to set the properties of the innermost subform that link it to it's parent form (which I will refer to as the middle subform).
Here's a thought. Try opening the "middle subform" in the designer (ie do not open the main form, just the middle subform from the navigation panel). then set the properties. This has a better chance of working.
Here's some references I used for inspiration, the first of which stresses the fact that the linked "fields" are actually EITHER control names OR field names from the dataset and why it is often best to use control names.
http://www.fmsinc.com/microsoftaccess/forms/subform/master-link-fields.asp
http://access.mvps.org/access/forms/frm0031.htm
I'm creating a simple form using Chronoforms, but so far I haven't been able to solve a small problem.
I would love to load two or three fields in a search done by the autocomplete element, i currently have two autocompletes working, but i can't seem to be able to load the other values into the corresponding textboxes.
I'm including the link to the form
http://cfobb.ca/index.php?option=com_chronoforms&chronoform=nomination_form
and as it can be seen, the first two fields in the first tab are working autocompletes, but i would love to have them linked so when the user chooses in any of the two, the other automatically gets filled. That selection would also trigger another sql query (that i already have, nothing fancy) that would fill the School Name drop-down menu. Also there's this code in the help tab
$form->data['_PLUGINS_']['autocomplete_processor']['result'];
but i don't really know how to use/handle it
Thanks
EDIT: For clarification, I'm talking in the below post about tabbed document browsing, not a Tab Control. However, if you're looking for roughly the same problem but regarding a Tab Control, Gord Thompson's answer is correct. Two answers for the price of one!
I've got an Access 2007 database that uses tabbed documents. I need to run some VBA code every time a user selects the form called "Reports", either via opening it or clicking on its tab if it's already open.
I could achieve much the same thing by closing it each time it's used and running the code on an OnLoad event, but ideally I'd like to keep it open so that users can keep the settings of the various drop down boxes, radio boxes etc that they've already set on "Reports".
I was hoping for an event that could run code on tab reselection, but neither of my guesses (OnCurrent and GotFocus) seem to work (OnCurrent works only when the form is opened, like OnLoad would).
Any ideas greatly appreciated - can't find what I'm looking for on Google, though I suspect that's because I don't know exactly what I'm looking for.
The .Value property of a TabControl returns the index (zero-based) of the current page. So, if I have a TabControl named TabCtl14 that contains two pages, FirstPage and SecondPage, then the code...
Private Sub TabCtl14_Click()
If Me.TabCtl14.Value = 1 Then
MsgBox "SecondPage was clicked."
End If
End Sub
...displays the MsgBox whenever I click the "SecondPage" tab in the TabControl.
Have found the answer I was looking for. It's the OnActivate event.
I am busy developing an MS Access 2007 application that requires the use of subforms with quite a complex user interface. I am aware on how to create a parent form and link to a subform so that it shows data relating to the parent form record, but my question is this:
If I have multiple nested subforms (say 3 or 4 levels down), can I somehow link a subform sitting on the 4th level with the record of the parent form on the 1st level? What I mean by nested subforms is having a form pasted inside a form, pasted inside another form, etc.
The subform that I wish to link with the parent form is currently using a query as its source object and the reason for using nested subform is purely for the aesthetics of the user interface.
Is there a simple way to go about this? Or perhaps using VBA?
One thing that many people don't realize is that the LinkChild/LinkMaster fields can actually be any valid expression. So, you could have subForm1's LinkChild/LinkMaster properties be:
LinkMaster CustomerID
LinkChild CustomerID
Then subForm2 could have this:
LinkMaster subForm1.Form!InvoiceID
LinkChild InvoiceID
...and so forth. I can't imagine going much deeper than that, but it's possible.
You might also consider if a cascading datasheet form might do the trick, using subdatasheets. You can even have a datasheet display a non-datasheet form as its subdatasheet (something I disconvered entirely accidentally when I switched a a parent form having a subform into datasheet view -- the subform remained displayed in form view). With subdatasheets, you don't have any issues with number of forms, or the limitation on embedding continuous forms.
If this is purely for aesthetic reasons (it looks pretty to you or someone else), rather than functional reasons, why not just use a rectangle, with a "Sunken" Special Effect?