473,326 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

If statement for an Open Event if button click

Hello

When my form opens I want to check IF the form was open clicking
Button#1 then do something else do something endif

Something like:

Private Sub Form_Open(Cancel As Integer)
If this-form-was-open-withButton#1 then
do something
else
do something
endif
end sub

Thanks

Aug 17 '06 #1
5 4194
If Me.OpenArgs = "Button#1" then
....
else
---
end if

Check OpenArgs in the Help

Arno R

"erick-flores" <ch**********@hotmail.comschreef in bericht news:11**********************@m73g2000cwd.googlegr oups.com...
Hello

When my form opens I want to check IF the form was open clicking
Button#1 then do something else do something endif

Something like:

Private Sub Form_Open(Cancel As Integer)
If this-form-was-open-withButton#1 then
do something
else
do something
endif
end sub

Thanks
Aug 17 '06 #2

Arno R wrote:
If Me.OpenArgs = "Button#1" then
...
else
---
end if
What if the button is on other form? the "Me." wont work
Let say the name of the form is MAINMENU

I tried:
If Forms![MAINMENU].OpenArgs = "button#1" then

and its not working....any ideas???

Aug 17 '06 #3

Or maybe there is an easy way to do it. Basically I just want to set
the nvigationsbutton=false is a button is press and =true if the other
is press.
I tried to put the code behind the actual button, but it didnt
work...is it possible to do this?

I did:
Private Sub open_currentuser_Click()

Dim stDocName As String

stDocName = "Expense Reports by Employee"
DoCmd.OpenForm stDocName
stDocName.NavigationButtons = False

End Sub

But it didnt work...it didnt even allow me to open the form

Aug 17 '06 #4
erick-flores wrote:
Or maybe there is an easy way to do it. Basically I just want to set
the nvigationsbutton=false is a button is press and =true if the other
is press.
I tried to put the code behind the actual button, but it didnt
work...is it possible to do this?

I did:
Private Sub open_currentuser_Click()

Dim stDocName As String

stDocName = "Expense Reports by Employee"
DoCmd.OpenForm stDocName
stDocName.NavigationButtons = False

End Sub

But it didnt work...it didnt even allow me to open the form
stDocName is not a form. It is a string that is the name of a form.

Forms(stDocName).NavigationButtons = False

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Aug 17 '06 #5

It worked, thank you very much

Aug 17 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Shamin | last post by:
Hi, Thanks in advance for answering to my Question. I'm stuck with this problem and would really appreciate any help. I have 2 aspx files (Main.aspx and ReportViewer.aspx). Main.aspx has a...
3
by: hb | last post by:
Hi, I have a asp:button btnGo. When clicking this button, the code will parse a asp:table to find a specific ID under certain conditions. Once the ID is found, the code need to keep the current...
2
by: carlor | last post by:
Hi there, I have a form that contains a link button. When the user clicks the link button I need to enable a couple of other buttons on the page and open a new browser window giving it focus...
6
by: shil | last post by:
I have a server side button that needs to do some preperation and afterwards, if everything goes well, open a new browser with a specific url. I know how to execute javascript from a server side...
6
by: Radith Silva | last post by:
Private Sub cmdCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCalculate.Click If txtName.Text <> "" Then If txtUnits.Text <> "" Then If optOne.Checked Or...
7
by: code100579 | last post by:
Hi there, sorry if this is a really simple question. I need to write code for: If a button is pushed and then one variety of other buttons is pushed then certain options on the program will...
2
by: Mattbooty | last post by:
Hello, Not sure if anyone else has seen this bug, but I have a form where the entire form is covered with a picturebox. The picturebox has a mouseup event. I also have an open file dialog for...
1
by: erick-flores | last post by:
Hello, I am trying to create an if statement, but its not working quite well. I need to see if a field is empty on my next form then dont open the form and display a message saying "you need to...
2
by: Del | last post by:
I have a form call frmMMD-PCKR. This form has seven buttons, each button represents a part. When I click on any of the buttons they open another form called frmTallyTagMMDPCKR. On the...
0
by: sandeep98811 | last post by:
I am getting following weird issue, "When forwarding an email with an open attachment the user warned twice that an attachment is open". I am catching Forward event of mail item in function...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.