Open form funcntion

Sangpo

Registered User.
Local time
Tomorrow, 01:08
Joined
Jul 7, 2012
Messages
35
Hi, I have following codes written in module to open form: But it is not working. So plse help me.

Public Function Openform(myformname As String)
DoCmd.Openform myformname
End Function

****************************

Private Sub Command2_Click()
Openform (“deleteDataF”)
End Sub
 
You say it is not working, but what actually happens.
Do you get an error message.
Check that the on click event of the button is set to [Event Procedure]
Have you tried to step through the code at runtime to make sure that it runs and to check the value of the variable myformname

You could try changing the name of your function. Try this:
Code:
Public Function fnOpenform(myformname As String)
DoCmd.Openform myformname
End Function
 
****************************
 
Private Sub Command2_Click()
fnOpenform (“deleteDataF”)
End Sub
Actually, why bother with the UDF at all. Why not just open the form with
Code:
DoCmd.Openform “deleteDataF”
in the on click event of the button.
 
I am trying to open forms using function Just to learn more about function and procedures. With this code I get error message, ambicouse name detected
 
I am trying to open forms using function Just to learn more about function and procedures. With this code I get error message, ambicouse name detected
Have you tried changing the name of your UDF to fnOpenform as I suggested in my previous post.
 
yes I tried,but still probelms. Anyway thank you for response.
 
Get rid of the parenthesis in the On Click event, it should look like;
Code:
Private Sub Command2_Click()

     fnOpenform “deleteDataF”

End Sub
 

Users who are viewing this thread

Back
Top Bottom