Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 24th, 2004, 06:37 PM
Authorized User
 
Join Date: Nov 2003
Location: Hillsboro, Ohio, USA.
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to bjackman Send a message via MSN to bjackman
Default Controls on another form

I have a form with a command button and when i click it, it opens another form to selct criteria for a report. what i'm trying to do is when i click button 1 to open the other form, i want to be able to disable certain controls depending on which command button was clicked on form 1. Is this possible?? Any help would be greatly appreciated.

Branden

Reply With Quote
  #2 (permalink)  
Old March 24th, 2004, 11:14 PM
Authorized User
Points: 306, Level: 6
Points: 306, Level: 6 Points: 306, Level: 6 Points: 306, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , .
Posts: 54
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Try putting some string like "condition_1" in the TAG property of the controls you want to have enabled when "condition 1" occurs (e.g. you click on a certain button in form 1 occurs). Use "condition_2" for some other type action.

Use the Open_Args parameter of the DoCmd.OpenForm to pass the string "condition_1" to the other form.

In form 1's OPEN event, read the Me.OpenArgs property. Then try something like this:

---------------------------------------------------
For Each ctl in Me.Controls

    If ctl.Tag = Me.OpenArgs then
        ctl.Enable = True
    Else
        ctl.Enable = False
    End If


Next ctl
--------------------------------------------------

You may have to "tweak" this but it has worked well
for me in the past.

Cheers!



--- Tom
Reply With Quote
  #3 (permalink)  
Old March 25th, 2004, 01:30 AM
Authorized User
 
Join Date: Nov 2003
Location: Hillsboro, Ohio, USA.
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to bjackman Send a message via MSN to bjackman
Default

I appreciate your reply but i actually figured it out. i used the following code

Private Sub cmdShiftReport_Click()
On Error GoTo Err_cmdShiftReport_Click

    Dim frmname As String
    frmname = "frmDetailReport"

        DoCmd.OpenForm frmname

            Forms.frmdetailreport.startdate.SetFocus
            Forms.frmdetailreport.EmployeeName.Enabled = False
            Forms.frmdetailreport.cmdStateDetail.Enabled = False

Exit_cmdShiftReport_Click:
    Exit Sub

Err_cmdShiftReport_Click:
    MsgBox Err.Description
    Resume Exit_cmdShiftReport_Click

End Sub

If this would help you out as it seems to be a little easier, feel free.

Branden

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding controls to a form Scootterp Access VBA 2 August 4th, 2009 02:32 PM
1 form, contains two seperate controls EricJ General .NET 2 August 10th, 2005 04:48 AM
Search Controls on a Form donnie_darko1983 ASP.NET 1.0 and 1.1 Basics 2 April 12th, 2005 05:20 AM
listing controls of form melvik C# 1 April 22nd, 2004 06:00 AM



All times are GMT -4. The time now is 05:44 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.