problem with openform function closing the previous form

  • Thread starter Thread starter paul via AccessMonster.com
  • Start date Start date
P

paul via AccessMonster.com

a newbie here.

Server: M$ SQL 2k
frontend: M$ Access 2003
file type: Access Project (.adp)

I have a form "A" with the following code:

Private Sub customer_data_modification_Click()

Dim email As Variant
Dim filter As Variant

filter = "u_email='" & Me![U_email] & "'"

DoCmd.OpenForm "f_main_1", acDesign, , , , acIcon
Forms!f_main_1.ServerFilter = filter
DoCmd.Close acForm, "f_main_??????", acSaveYes
DoCmd.OpenForm "f_main_??????"

End Sub

When a button is pressed from the Form "A", the code opens f_main_1 form
and closes the "A" form that the event is called from.

Problem: I would like to keep the Form "A" open, but the code closes the
Form "A"

I've tried acNormal instead of acDesign, but when I do that, the
serverfilter property doesn't get updated with the "filter" condition, a
major problem.

What I do is that the fuction gets the U_email parameter(a textbox) from
the Form A, opens the f_main_1 form and change the serverfilter property of
the opened form to "u_email='" & Me![U_email] & "'"

Any input will be appreciated.

TIA.
 
Hi,

I suppose you close

Docmd.Close acForm,"f_main_1",acSaveYes

instead of

Docmd.Close acForm,"f_main_?????",acSaveYes


Do you have all sp installed? Are there some timers in the program?


- Raoul
 
My bad. The code should have been:

event procedure in Form A

Private Sub customer_data_modification_Click()

Dim email As Variant
Dim filter As Variant

filter = "u_email='" & Me![U_email] & "'"

DoCmd.OpenForm "f_main_1", acDesign, , , , acIcon
Forms!f_main_1.ServerFilter = filter
DoCmd.Close acForm, "f_main_1", acSaveYes
DoCmd.OpenForm "f_main_1"

The problem is that the code works fine, but the subroutine also closes the
original form, the Form A.

Is it by the design of acDesign? acNormal and other option doesn't close
Form A... How odd. But I really need the acDesign option here, because
the serverfilter property doesn't get changed with any other options...

Is there a work-around?
 
Back
Top