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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

close and reopen tab form to record and page 1

Status
Not open for further replies.

dbar10

Programmer
Dec 5, 2008
196
US
I have a Form called [Clients Add/Edit] it is a tab form with 5 tabs controls. I am working on the [Physicians] tab. I have a command button that opens a form to add new physicians. When I add new physicians here, I close the forn and then I need to requery the main form to pickup the new physician. I have tried many different solutions with no avail. I believe I need to close the Clients Add/Edit form and reopen but I need help with the code. On the close event of my add Physician form I want to:
Echo off
Close Clients Add/Edit
Open Clinets Add Edit
But I need to come back to the same record which is determined by ClientID and to the Physicians tab on that form. Can you please help? Thanks
 
You are a Lifesaver!! As you can see I am still learning and I really appreciate your help. I'm not sure if I missed something but, I changed the lnkClient button to Enabled On so that I could click it. You said the Caption of the button would have the clients name in it? It just say Link to. Did I miss something?
 
AceMan, In my testing, After I put in the New Physician and click Link to, I'm getting the error " Run Time error '7768' In order to change data through this form, the focus must be in a bound field that can be modified"

Then debug highlights: Me.Dirty = True 'Save if New Record

The first time I tried this code it worked but know I've gotten this 3 times.

Your thoughts.
 
OK, I figured out that if I out in a new physician record I have to tab all the way through then back up one record to what I just added then hit Link to and it works. Is there anyway to avoid having to back up one record?
 
dbar10 . . .

So sorry, ... forgot a piece of code! In the [blue]On Load[/blue] event of [blue]Physician Demographics[/blue], copy/paste the following:
Code:
[blue]   If IsOpenForm("Clients Add/Edit") Then
      Me!lnkClient.Enabled = True
      Me!lnkClient.Caption = "Link to " & Forms![Clients Add/Edit]!FullName
   End If[/blue]
As you can see the button is enabled only if [blue]Client Add/Edit[/blue] is open. You can't/shouldn't link unless this is so ... otherwise errors will be raised. So change enabled back to false.

The error with the [blue]Dirty[/blue] propery in code is mine:
Code:
[blue]Change: If Me.Dirty Then Me.Dirty = True
To:     If Me.Dirty Then Me.Dirty = [purple][b]False[/b][/purple][/blue]
A good initial test is to navigate to a record then hit the Link button.

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
That works much better, Thanks. I navigated to existing records and that works great. Now, how about when I am putting in a new record? As I said earlier, I am having to complete the record and then navigate back to it to Link it. Can you help me with a way around that?
 
dbar10 . . .

The Dirty problem should've taken care of that! Try again without completing!

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
dbar10 . . .

[blue]?[/blue] [surprise]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
TheAce Man1, I did respond. I don't know why it didn't come through. Everything is working great. I appreciate your help very much. I am a supporter of this website and I believe my investment is small compared to the help that I have received but I pledge my ongoing support and this is the best resource that I have found. Thanks again. dbar10
 

[thumbsup2]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top