Button close form and opens another but want to keep the same ID (1 Viewer)

johnhobbis

Registered User.
Local time
Today, 11:36
Joined
Apr 5, 2001
Messages
22
The VB closes the form and opens another, but I have a ID on the form [frm_HDUITU_followup]I am Closing.

I want to go straight to the same ID on the form [frm_MainDischarge] that I am opening.

============================================
Private Sub DISCHARGE_Click()
Forms![frm_HDUITU_followup]!At_Risk_Register = False
'close the form
DoCmd.Close acForm, "frm_HDUITU_followup"
'open the other form
DoCmd.OpenForm "frm_MainDischarge", acNormal

End Sub
============================================

Anyone got any ideas for me....

Hopefully

John H
 

DES

Technoweenie
Local time
Today, 06:36
Joined
Apr 17, 2001
Messages
245
You have to do two things.

First you need to open the second form using a criteria statement with the docmd such as:

DoCmd.OpenForm "Employees", , ,"LastName = 'King'"


Then you want to close the first form.

So you end up with something like:

============================================
Private Sub DISCHARGE_Click()
Forms![frm_HDUITU_followup]!At_Risk_Register = False
'open the other form
DoCmd.OpenForm "frm_MainDischarge", acNormal, , "Forms![frm_MainDischarge]![Whatever is your control] = Forms![frm_HDUITU_followup]![Whatever is the control]"

'close the first form
DoCmd.Close acForm, "frm_HDUITU_followup"

End Sub
============================================

That should give you a little bit more like what you want.
 

johnhobbis

Registered User.
Local time
Today, 11:36
Joined
Apr 5, 2001
Messages
22
Unfortunately, When I implement this change the opening form comes up completely blank.!! just the background, i go to design mode and the form is there??

============================================
Private Sub DISCHARGE_Click()
Forms![frm_HDUITU_followup]!At_Risk_Register = False
'open the other form
DoCmd.OpenForm "frm_MainDischarge", acNormal, , "Forms![frm_MainDischarge]![OutreachID] = Forms![frm_HDUITU_followup]![OutreachID]"

'close the first form
DoCmd.Close acForm, "frm_HDUITU_followup"

End Sub
=============================================
 

DES

Technoweenie
Local time
Today, 06:36
Joined
Apr 17, 2001
Messages
245
Send me a sample with just what is necessary and I will have a look at it for you. If you need it right away send it in 97.
 

Users who are viewing this thread

Top Bottom