Save databound table information spread across 3 tabs vb.net - vb.net

I have a Windows form with a tab control on it. I have fields from one bindingsource on 3 tabs of the tab control. I can open the form and change data on all 3 tabs and navigate between tabs and my changes are there. When I click on the 'Save' button on the BindingNaviator, not all of my changes are saved to the table I am bound to. Is there something special that needs to be done to not lose the changes?

I found the issue. On Tab2 of my tab control I have some number fields. There is also a checkbox the user can select to set those number fields to 100, and if they uncheck it, it was setting the the .text property of those to "". The fields should be set to 0 instead of a blank. After I made this change, it works fine. Thanks for the help.

Related

How to dynamically open a form within a tab?

I have a parent form with a tab control. The tabs show subforms. Data shown in the parent form is general details about residential property, such as address, etc. In the tabs, the subforms show data that is county-specific and exhaustive, like garage square footage and on and on.
There are 6 tabs with a static subform i.e. that tab always shows the same subform. I'd like the 7th tab to dynamically open a subform depending on which county the property exists in. That is, based on the value of a control (Me.Form.County), populate this 7th tab with the corresponding subform for the highly specific details for that county.
(No, it's not desirable to make one subform that could render data for any county; it'd be huge, relatively. One form per county is the requirement.)
It'd be nice if there's a way to act on the event of clicking on the 7th tab to then open the county-specific subform, though I don't see OnClick for a tab. If there's a way that's close to that simple for the user that'd be fine too.
You can use the Subform.SourceObject property to change which form is displayed in a Subform control.
https://learn.microsoft.com/en-us/office/vba/api/access.subform.sourceobject
You can use the Change event of the Tab Control to respond to the user switching tabs and display the correct subform if they are looking at the desired tab.
Private Sub tabCounty_Change()
If tabCounty.Pages(tabCounty.Value).Caption = "County Info" Then
subCountyInfo.SourceObject = "frmCounty" & Me.Form.County
End If
subCountyInfo.Form.Requery
End Sub

Excel VBA Add a scroller to Form Control Combobox

I was wondering is anyone knows how to add a scroll bar to a form control combobox thats on my excel sheet (not in a user form), because I currently have 40 items in the list and it just goes off screen and I have to use the up and down keys to scroll the list, also is there away to set the length of the list so it a small list with a scroll bar?
I have 1200 of these combobox in my workbook, so I hope there is a generic way to apply this to all combobox's
Many Thanks
Right-click, choose 'Format control', set the 'Drop down lines' number to something like 8. You might want to look into Data Validation lists rather than 1200 controls!

Turn off field programmatically in VB.Net

I'm creating an addin button in Arcmap via VB.net that when clicked, runs the identify tool. But I want only selected fields to appear in the identify dialog. I thought of hiding the unnecessary fields and then showing them again after the button is used.
Does anyone know how to programmatically turn off/on field?
you have to iterate the fields in layer and then set visible property into false .
see this link in
gis.stackExchange

Access forms and sub-forms

I am building a database on MS 2003. I have one form which calls for a series of options. This form is based on the table "Categories" which is linked to the main table by Customer ID.
Now, both forms appear together on the same screen, what I am trying to do is have the person select one or more of the categories and in pressing a command button then those categories which were selected will show its respective forms. The forms are invisible until selected and until the command button is pressed.
Since they are two different forms (categories in one) and the entry form on another, How do I program the command button to make the entry form visible FROM the other form?
The sub-form is located in a tab. I dont want to show it as a pop-up but to become visible within the tab where it's located
If the form is open but invisible then you can refer to it as a member of the forms collection and make it visible:
forms("myForm").Visible = true
If the form isn't open then get its name from the AllForms collection of the project and then use the OpenForm method:
docmd.OpenForm currentproject.AllForms("myForm").Name, acNormal
Pseudologic: you are basically going to want to set the Visible property with all of your forms to False during the form's Open event. You should place this Visible = False code in a separate subroutine so that the code structure can be called during other events too. (For example you may want to provide a Reset button so that the user can reset the form, or trigger the "set false" code when a new customer id is selected.) Then with every selected category you would set its associated form property visible by setting Visible = True.

Option Group frame: can I add text boxes that are part of the frame instead of rad button options?

Ok so this maybe a simple/silly question but I don't know so here goes:
In access let's say I want to have a frame control, so I click the option group button and add it to the desgin surface. However, I am not wanting to use this as a option group with radio button selection, instead I would like to add text boxes instead the frame, so that when I reference the frame, it references every control instead of it, hence the text boxes, cbo boxes, etc.....just as it would if they were radio option selections.
So can you do this?
I want whatever controls I add inside the frame to be easily referenced (i.e. make all controls visible just by using frameExample.visible = true) so that I can build my own tab control groupings.....
can this be done?
Thanks!
EDIT:
What I am trying to accomplish is having a form that includes a collection of controls (input controls - cbo boxes, text boxes, etc), that serve as the Main record information. These are saved to a table via an INSERT statement on button_click because this form is unbound.
Next I have 8 categories that are relative per each main record (and data that goes along with it). Each of these categories could have a sub form area and a button click that bring it's relative form into the sub form area. These sub forms would be unbound as well as I would just save data via SQL statement. So i know I could accomplish this by running the insert statement from the parent form, on the main collection control's data that would create the KeyID number, then run a SQL statement that would turn around and load that KeyID number right back onto the page in a hidden text box.
Then when I click one of the sub forms and load its relative collection of controls, I could then save that data along with KeyID for each of these sub-forms/tables.
SO......
I was wondering if instead you could define these controls as a collection so that you could hide and make visible all the ones you need on button clicks and avoid the need for additional forms (subs). I know that if a user enters data into a text box, and then somewhere along the way that box becomes hidden, the data still exists in it and still ends up in the SQL statement....
So I want all these controls to exist on the same form, but I thought what is I could encapsulate them into a frame like an option group, then I could call the frame and all the relative controls would be called up (made visible) as needed.
Sorry for the long explanation but I thought it would help.
I do not think you can do it with an Option Group, but what you are describing is pretty much a subform, yesno?
Some examples of hiding the tab control from an app that went live in March 1998:
Tab driven by transparent command buttons over labels styled to look like colored command buttons:
Same approach, more buttons:
In this case, fake colored command buttons don't drive the tab, but insted show/hide the tab and a subform. In this case, the tab is actually driven by the listbox:
A view of when the tab is hidden and the subform revealed. The listbox drives navigation within the subform, which has a visible tab on it:
So, there's a lot that can be done without showing the tab control.