473,387 Members | 3,033 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,387 software developers and data experts.

This If/Then Has Got to Be Easy But....

I have a database of employee's names -- if they are on a certain
disciplinary level then a box called CAP is checked in the employee's
name table.

I have a form that has a combo list of employees' names so that
supervisors can check on various past disciplinary actions. There is
nothing on the form except the combo list and a command button.

In order to display the data correctly there are two different macros
that I have -- one if the person is "on CAP" (i.e., CAP = True) and
the other where the person is "not on CAP" (i.e., CAP = False)

The structure I am basically going for is:

If CAP is TRUE then
Run Macro1
If CAP is FALSE then
Run Macro2

I know this is incredibly simple but I am just having terrible trouble
with the syntax in the "On Click" procedure -- Access needs to look at
the record of the employee whose name is in the combo box -- then see
if the employee is (or is not) on CAP, and then run the appropriate
macro.

Please help! I'm a relatively new self-taught user and have been able
to get everything else to work... just not this!

Thanks

Jun 11 '07 #1
3 1701
If I got it correctly, you might want to use the following as a
rowsource for the combo:

SELECT EmployeeName, CAP FROM tabNames

(with obvious meanings for EmployeeName, CAP and tabNames)
Then your code should look like

IF cmbCAP.Column(1) THEN
run macro1
ELSE
run macro2
END IF
Jun 11 '07 #2
Add a second column to your combo box. Give it a width of zero.

Then, in the controlsource for the combo box add a second field -- the CAP
field. So the control source should have two fields: the one that's there,
and the CAP field.

Next, in your OnClick event, use the following:

If Me.MyCombo.Column(1) Then
docmd.RunMacro "Macro1"
Else
docmd.RunMacro "Macro2"
End If

Replace "MyCombo" in the above with whatever your combo box is called.

The Column property is zero-based. So Column(1) in the above refers to the
second column of the combo box.

If your combo box already has two columns, then just add a third, and adjust
everything written here accordingly.

HTH,

Neil

"Isaac" <im***@sio.midco.netwrote in message
news:11**********************@m36g2000hse.googlegr oups.com...
>I have a database of employee's names -- if they are on a certain
disciplinary level then a box called CAP is checked in the employee's
name table.

I have a form that has a combo list of employees' names so that
supervisors can check on various past disciplinary actions. There is
nothing on the form except the combo list and a command button.

In order to display the data correctly there are two different macros
that I have -- one if the person is "on CAP" (i.e., CAP = True) and
the other where the person is "not on CAP" (i.e., CAP = False)

The structure I am basically going for is:

If CAP is TRUE then
Run Macro1
If CAP is FALSE then
Run Macro2

I know this is incredibly simple but I am just having terrible trouble
with the syntax in the "On Click" procedure -- Access needs to look at
the record of the employee whose name is in the combo box -- then see
if the employee is (or is not) on CAP, and then run the appropriate
macro.

Please help! I'm a relatively new self-taught user and have been able
to get everything else to work... just not this!

Thanks

Jun 11 '07 #3
That did it! Thanks!


Jun 11 '07 #4

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

Similar topics

18
by: Scott Brady Drummonds | last post by:
Hi, everyeone, I recently stumbled on some code that someone else wrote that I don't like. However, I'm having trouble articulating what the bad quality of the following code is. The...
2
by: Hal Vaughan | last post by:
I'm self taught and most of what I've been working on for the past several years has been entirely in Perl and Java. I've noticed that I can code about 5 times faster in Perl than Java, in part...
20
by: David Levine | last post by:
I ran into a problem this morning with event accessor methods that appears to be a bug in C# and I am wondering if this a known issue. public event SomeDelegateSignature fooEvent; public event...
83
by: deppy_3 | last post by:
Hi.I am started learning Programm language C before some time.I am trying to make a programm about a very simple "sell shop".This programm hasn't got any compile problem but when i run it i face...
28
by: H J van Rooyen | last post by:
Hi, I want to write a small system that is transaction based. I want to split the GUI front end data entry away from the file handling and record keeping. Now it seems almost trivially easy...
59
by: Kevin Walzer | last post by:
From the introduction to PyObjC, the Python-Objective-C bridge on Mac OS X: "As described in Objective-C for PyObjC users the creation of Objective-C objects is a two-stage process. To initialize...
4
by: Rick Stevens | last post by:
I am not an access expert, could anyone tell me if the following would be easy to do?? I receive emails from a specific email address, that advise me if a specific piece of equipment my company...
14
by: Grant | last post by:
I've seen a couple of articles on the internet that VB.NET applications can be decompiled very easy. For those who have had experience with this, is it true? What steps can be taken to avoid...
7
by: adfghergaer | last post by:
First of all, I'm not a programmer. I'm here because I had an idea for a software program that my employer may hire someone to design, and I'm wondering what kind of investment it would take to hire...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.