Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refresh?

Status
Not open for further replies.

indygirl

Vendor
Nov 1, 2006
35
US
I have a main form with a field for a company name. The user has the ability to choose the drop down menu and choose from a list (which is a linked table from our server). When the company is chosen, the appropriate fields for the person is completed...address, phone number, etc.

I have 3 sub-forms that the user enters data into. However; when the user clicks a command button and opens a sub-form then closes the sub-form, the information that completes in the appropriate fields based on the company selection in the drop down menu on the main form seem to revert back to a default entry. So basically, it looks like I work for a company but when I open and close a sub-form, I am no longer there. John Doe works for the company.

Does that make sense?

Everyone has been wonderful in helping me with this database, I am hoping that I can get some more great advice on how to keep the information where it is supposed to be.

Thanks!
 
Have you tried the .requery or .refresh methods in the close event of the subforms?

Outside of a dog, a book is man's best friend. Inside of a dog it's too dark to read.
 
Are the subforms linked to the mainform ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Genomon: No, I have not tried the .refresh or .requery. Not sure I undestand how. See I am a complete novice at Access and databasing...I have only tinkered around figuring things out on my own. It is amazing what I have accomplished so far but I think I am creating a monster. Sorry, if my questions seem so elementary.

PHV: No, they are not linked. Not sure how to link them. I recall seeing Master/Child Links at one point but I cannot see them in the properties panel any longer. Not sure why.

I certainly appreciate any help you can lend.

Thanks!
 
The Master/Child Links properties are for the Control hosting the subform, not the subform.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Good place to start (don't let on how easy this is, or they will all want to do it!):
Open the subform in design view.
Show the code window (click on View|Code).
This will pop up the VB IDE (Visual Basic Integrated Design Environment) where you will be adding your code.
On the top left drop-down list, click on "form".
Now you need to add code to the Close() event.
From the top right drop-down, click on "Close".
You should see this:
Code:
Private Sub Form_Close()

End Sub
Try adding the requery method
where you replace MainFormName with, strangely, the name of the main form:
Code:
Private Sub Form_Close()
    Forms![MainFormName].Requery
End Sub

Probably need to repeat for all subforms. If it doesn't do the trick, post back & we'll try something different!
Howzit feel to be a programmer?
[ponder]



Outside of a dog, a book is man's best friend. Inside of a dog it's too dark to read.
 
Thank genomon. But it doesn't seem to recognize the form name. I triple dipple checked and everything looks right.

It looks like it only goes back to a default when I change from form view to design view than back to form view. Is there a way to disable the design view when I am finished creating my FrankenBase? If so, that may be my answer.

Also, I have another issue. I need to link orders from data entry on the sub-form with the client chosen from the drop down menu on the main form.

For example: I choose Jane Doe from a drop down list on my main form. Jane's information - address, phone number, etc. appear. I verify this is the client, click the command button to take me to an order form (sub-form #1) and enter the order. I need the data to be saved with the client not just saved. How can I conquer this?

I am actually taking a class right now in OOP. I love this programming stuff - especially when it works!

 
First, you need to get the form name from the form properties page and use that. If it doesn't work, post back the error message and we will beat it mercilessly.
[hammer]
Second issue:
Not sure what you mean by "I need the data to be saved with the client ". Do you need to create a third table called "Orders by Client" or something like that?

[idea]

Outside of a dog, a book is man's best friend. Inside of a dog it's too dark to read.
 
I tried the form name and the error message I receive is as follows:

Run Time Error '2450'

Microsoft Office Access can't find the form "Public Folder Contacts021907' referred to in a macro expression of Visual Basic Code.

Which is odd since that is the name of the main form.

I captured a screen shot but it would not let me enter it in the post.

Geez, I feel like such an ameteur.

Yes, I created a new table for the orders but I would like the user to enter the information from the form and have it added to the table. I need to make sure that when a user selects a client from the main form that the user can view all of their orders or enter a new order via the sub-form. So basically, if I select Company "A" on the main form, I would like to view the most recent order on the sub-form and have the capability to view all the other orders for Company "A" via navigation buttons. I am just not sure how to accomplish this.

Thank you so so much for all your help with this.




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top