Microsoft Access How to refresh the parent form from the subform - forms

I know this question has been ask thousands of time, but I couldn't find a direct answer for this problem.
I am a programmer, but I never bothered learning VBA since this is only a small project I am doing on the side. I would prefer only using macro's.
I currently have a parent form inside a navigation menu, which has a datasheet table which display all the information about all the customers.
http://i.stack.imgur.com/d3TdM.png
In this parent form, I have a button to allow the user to add a new customer which opens a pop up form.
http://i.stack.imgur.com/RDSvq.png
I want the save button in this pop up form to update the parent form onClose. I know the record is working since if I switch off to a different tab and come back to it. I can see the new record added to the table.

Put this on the form frm_addNewCustomer on close event
Private Sub Form_Close()
[Forms]![TheFormYouWantUpdated].Refresh
End Sub

Related

Requery Listbox on secondary form when another form is closed

I have two forms, frmOwnership and frmContactDetails. On frmOwnership you can click a button to open frmContactDetails to a specific record.
The issue I'm having is frmContactDetails is opened from several different sources, and doesn't designate (and can't really?) a form to open when it's closed. And frmOwnership is not openable from frmContactDetails, meaning when you go to edit a record in the Contact Details, the Ownership form stays open. However, I'm looking to refresh a control (lstItem) on frmOwnership when frmContactDetails is closed. I tried to add a requery call (lstItem.Requery) to the Got_Focus procedure, but it's not refreshing.
Thanks!!
The easiest thing to do is open frmContactDetails with acDialog (as a popup on top of whatever other form is opening it). Then whatever VBA code opens it on the original form only continues after frmContactDetails is closed and you can put your refresh there.

Microsoft Access New Tab button in Form

What I'm trying to do is create a form where people input data. They're basically going to be tracking what they've done on a computer.
I'd like to have one main form that starts off with a brief intro and then a tab where they're going to be entering the information.
I'd like them to have the option of adding new tabs, so they can track their actions with multiple computers at once.
What would I need to have the button do in order to open a new tab next to the existing one?

MS Access: Disabling Navigation Buttons

I have to create a database for a one off work project and everyone has decided to use access as it is already installed on every machine. Now I'm new to access and new to databases in general so this has been a bit of a struggle. Still I'm getting there and have managed to make all the tables, set up relationships between them and create basically all the forms, but seem to have fallen at the last hurdle.
We have lots of different sites, each of which has lots of different rooms. What I am struggling with is the form for rooms. This is loaded from the site form. So site A will bring up a form with all the rooms in site A. The form can be loaded in read only, modify, or new record modes.
The problem is with the navigation buttons at the bottom. If you click new record using the navigation button then access creates a new record, but it loses the FK reference to the previous site. I have put a 'sort of' fix on this by making the FK on the form a combobox, so it can be corrected, but there are 40 sites so it isn't very elegant and isn't the behaviour anyone would expect.
To try and get around it I decided to try and build my own version of the access navigation controls, and eventually (with a lot of help from previous questions on stackoverflow) I succeeded and at the bottom of the form you can go to the first record, previous record, next record, last record, add a new record (keeping the FK reference) and even search through the loaded records in the recordset.
However all that becomes useless the moment I switch off the navigation controls. As soon as I set that to off for whatever reason access only loads the first record in the record set. So if site A has 10 rooms you only see room 1, and the controls I made (which work perfectly with navigation controls on) stop working, and furthermore the textbox I set up to mimic the '1 of 10' record number indicator changes to '1 of 1' making it clear that none of the other records are accessible.
This is really frustrating as it means I can only use my custom navigation controls by keeping Access's turned on. I don't want the access one turned on as it creates problems every time a new record is created.
So, after that long introduction, my question is: Why is access only loading the first record with navigation controls off, is there a way to stop this happening, and if not, can I just disable the new record bit of the navigation control?
Any help here would be greatly appreciated. I am sure it is a very simple thing, but googling has turned up nothing, and actually from what I have read I'm not even sure disabling navigation controls normally does this which makes the whole thing all the more depressing as this is literally the only form I don't want them on.
Thanks,
Dean
If your only reason to add your own navigation controls was that you couldn't have the FK in you rooms form filled, I would keep the access navigation controls and set the FK in the Form_BeforeInsert() trigger of your rooms forms with something like this:
Private Sub Form_BeforeInsert(Cancel As Integer)
Me!FK = forms!Sites!PK
End Sub
If you would like to keep your own navigation controls, it would be helpful, to see your code to be able to answer your question.

How can I change the whole structure of a form by clicking a button ( Visual C# Express 2010 )

I'm new here as I am programming with Visual C# Express 2010.
Thats the case:
I have the first form, it contains labels, buttons, textboxes etc. I want one of these buttons to change all the aspects of this first form in order to create a second one.
An example of what I want is an ordinary installer program. It has one form ( I think ). And we have "next" button. Clicking on it, the whole form structure will change.
PS: Im not making an installer program.
Thank you!
It might be easier simply to develop a new form, and have the button launch an instance of that new form.
That said, you can programatically change aspect of GUI elements by using the appropriate properties.
For example, suppose you have a label lblStatus somewhere on the form. You can change its location and text with the following lines:
lblStatus.Location = new Point(20, 0);
lblStatus.Text = "Updated Status";
Hopefully this is helpful to get you on the right track.
You could do multiple things:
Use tab pages for each page of things that you want. Add a button outside of the tabs that will change to the next one.
Add a button and a panel on the form. Each page of the form is a different UserControl. When you click the button, fill the panel with a new instance of the UserControl that you want.
Do something like this: http://www.codeproject.com/KB/miscctrl/DesignTimeWizard.aspx
Or this: http://visualstudiogallery.msdn.microsoft.com/en-us/c2c412fd-bd28-4e3b-9c20-4dc381ac5199

Editing Records with MVVM/MVVM-Light

I have created a very simple wpf app with mvvm light.
I have rows in a list view, these are templated representations of Book objects.
I can click a row, then click an edit button, this button loads a new window and sends the new window the book to edit (using mvvm-light's Messenger).
The issue I have is when I edit the record in my new window the data on the main form is updated. The text boxes are bound to the object received via the Messenger.
I know this is because I have essentially passed a reference to the same Book object around the place, therefore I update in one place.. and voilĂ  it updates on the main page too.
What I would like to know is.. is there a standard way/method/concept to achieve what I am trying to do? i.e. create an "edit" page/screen with the option of discarding the edits?
thanks.
Could you make your entity implement ICloneable and create a clone for editing?