problem with openform function closing the previous form

  • Thread starter paul via AccessMonster.com
  • 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.
 
G

Guest

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
 
P

paul an via AccessMonster.com

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top