Hi! I'm new to this forum, and new to Access.
I'm attemtpting to convert an application I developed in Excel in order to capture the power Access provides. Given the nature of my data, a relational DB is where I need to be as opposed to the way I've prototyped things with Excel.
I'm hitting a wall though on manipulating Access Forms. In Excel, I make extensive use of UserForms that I manipulate with VBA. Often, I take advantage of the _Change Event, for a Field(eg. TextBox) on the Userform to trigger changes in related fields.
Although the Access Help file refers to a Change Event, it doesn't appear it really exists in the context I'm attempting to use it, thus I've resorted to the AfterUpdate event. However, I'm finding that this event does not fire off when the Value of a Field changes via VBA code; it only seems to fire off through user interaction via the GUI.
Here's what I'm trying to accomplish...as a newbie to Access I'm most interested in any recommendations as to how to achieve my task. Perhaps I've been going about things in a fundamentally wrong manner??
I have three primary tables to define my relationships. Clients, Properties, and Contracts. Each client can own multiple Properties, each property can have multiple associated Contracts.
I've created a Form with a Tab control. In the Form's Header I display the Client Name and Phone number for the record being viewed. The first page of the Tab Conrol contains other fields from the Clients table for the current Record. That all works fine.
It's the second Page of the Tab control where I'm having issues. I've created two Listboxes for this page. Listbox1 to contain all the properties associated with the current client, and Listbox2 to contain all the Contracts associated with the selection in Listbox1. (I don't need to see all of a Client's contracts here, just the one's associated with a given property.)
ListBox1 gets populated with all the Properties associated with the current Client during the Form_Current event by doing a .Requery for the Listbox. After hacking my way through creating Queries, I've got that working fine. From there, I attempt to do a .requery on a Subform that contains various data associated with the Property selected in the Listbox1. This is where I'm having timing issues. It's not until I click Litbox1 with the mouse that I am able to successfully populate the subform. I do this through the Listbox1_AfterUpdate event, it works fine. however, I'm used to having a _Change event to handle this scenario...the value of the Listbox1 changes (via code), and then other things happen (eg. Requery the subform) I would like the Subform's data to be updated with the associated data to Listbox1's first record, automatically, without having to click the Listbox.
I've disocvered that I can't set the .listindex property of the Listbox via VBA, this was odd to me, coming from Excel. I discovered the .Selected
property, and have used this to indirectly set the listindex of the Listbox by using .Selected(0) in the code, thinking this might trigger the AfterUpdate event and thus I could Requery the subform there. AterUpdate doesn't fire until I click the Listbox with my mouse however.
I have more related issues, like populating Listbox2 without having to first manually click a record in Litbox1, but instead have it done during the Form_Current event by using the first record in Listbox1, but I'll leave those for now.
In summary, I need to browse the clients, maybe with the navigation bar at the bottom for starters, and have the new client's first property data, and the data associated with the first contract for the first porperty, appear in the appropiate subforms without having to click the form anywhere. I know this can be done, and I know how to do it with Excel Userforms but I'm a little lost in Access.
I feel that I'm close, but maybe I'm fundamentally off here. Any insight would be much appreciated.
Thanks in Advance!
I'm attemtpting to convert an application I developed in Excel in order to capture the power Access provides. Given the nature of my data, a relational DB is where I need to be as opposed to the way I've prototyped things with Excel.
I'm hitting a wall though on manipulating Access Forms. In Excel, I make extensive use of UserForms that I manipulate with VBA. Often, I take advantage of the _Change Event, for a Field(eg. TextBox) on the Userform to trigger changes in related fields.
Although the Access Help file refers to a Change Event, it doesn't appear it really exists in the context I'm attempting to use it, thus I've resorted to the AfterUpdate event. However, I'm finding that this event does not fire off when the Value of a Field changes via VBA code; it only seems to fire off through user interaction via the GUI.
Here's what I'm trying to accomplish...as a newbie to Access I'm most interested in any recommendations as to how to achieve my task. Perhaps I've been going about things in a fundamentally wrong manner??
I have three primary tables to define my relationships. Clients, Properties, and Contracts. Each client can own multiple Properties, each property can have multiple associated Contracts.
I've created a Form with a Tab control. In the Form's Header I display the Client Name and Phone number for the record being viewed. The first page of the Tab Conrol contains other fields from the Clients table for the current Record. That all works fine.
It's the second Page of the Tab control where I'm having issues. I've created two Listboxes for this page. Listbox1 to contain all the properties associated with the current client, and Listbox2 to contain all the Contracts associated with the selection in Listbox1. (I don't need to see all of a Client's contracts here, just the one's associated with a given property.)
ListBox1 gets populated with all the Properties associated with the current Client during the Form_Current event by doing a .Requery for the Listbox. After hacking my way through creating Queries, I've got that working fine. From there, I attempt to do a .requery on a Subform that contains various data associated with the Property selected in the Listbox1. This is where I'm having timing issues. It's not until I click Litbox1 with the mouse that I am able to successfully populate the subform. I do this through the Listbox1_AfterUpdate event, it works fine. however, I'm used to having a _Change event to handle this scenario...the value of the Listbox1 changes (via code), and then other things happen (eg. Requery the subform) I would like the Subform's data to be updated with the associated data to Listbox1's first record, automatically, without having to click the Listbox.
I've disocvered that I can't set the .listindex property of the Listbox via VBA, this was odd to me, coming from Excel. I discovered the .Selected

I have more related issues, like populating Listbox2 without having to first manually click a record in Litbox1, but instead have it done during the Form_Current event by using the first record in Listbox1, but I'll leave those for now.
In summary, I need to browse the clients, maybe with the navigation bar at the bottom for starters, and have the new client's first property data, and the data associated with the first contract for the first porperty, appear in the appropiate subforms without having to click the form anywhere. I know this can be done, and I know how to do it with Excel Userforms but I'm a little lost in Access.
I feel that I'm close, but maybe I'm fundamentally off here. Any insight would be much appreciated.
Thanks in Advance!