473,404 Members | 2,174 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,404 software developers and data experts.

if else function to fill field on access 2010?

Hello guys,

I have this database on access 2010 and I want to fill a field with the use of the "if...else" expression with multiple conditions. From what I found out, the if else expression can only be used on vba. I haven't figured out how to do that yet. My question is, is that something that can be done or am I wasting my time? And if it can be done, could someone help me out?

Thank you so much in advance. I know the very basics of programming, so explain very plainly please...

Thanks again...

VP
May 27 '17 #1

✓ answered by NeoPa

Hi VP.

Phil's absolutely right. If ... Else ... End If is a specifically VBA construct that isn't usable in SQL. Nevertheless SQL does support functions that are publicly available as well as those you may write yourself.

Functions that can be very useful for assigning values depending on other values are many, but include :
IIf(), Switch() & Choose().

You can find more about each of them by typing the name in a VBIDE code pane (The Immediate Pane is always a good one for such things and can be reached by pressigng Ctrl-G.) and pressing F1.

As for helping further at this stage, I'm afraid Phil's right about that too. Without further information from you we'd be at a loss. We all start somewhere though, so I'm sure we can move forward now you understand better. Always assuming you need further help now you already know about some useful functions you can use in SQL.

2 793
PhilOfWalton
1,430 Expert 1GB
With so little information to go on, it is unlikely unless one of the contributors is psychic, you will get much help.

Are you talking about queries, or forms?
Where are these multiple conditions coming from?

You are correct that VBA uses the if ... else expression, but look up the Iif function which can be used in a similar fashion in queries, forms & reports. (Iif is not a typo)

Phil
May 27 '17 #2
NeoPa
32,556 Expert Mod 16PB
Hi VP.

Phil's absolutely right. If ... Else ... End If is a specifically VBA construct that isn't usable in SQL. Nevertheless SQL does support functions that are publicly available as well as those you may write yourself.

Functions that can be very useful for assigning values depending on other values are many, but include :
IIf(), Switch() & Choose().

You can find more about each of them by typing the name in a VBIDE code pane (The Immediate Pane is always a good one for such things and can be reached by pressigng Ctrl-G.) and pressing F1.

As for helping further at this stage, I'm afraid Phil's right about that too. Without further information from you we'd be at a loss. We all start somewhere though, so I'm sure we can move forward now you understand better. Always assuming you need further help now you already know about some useful functions you can use in SQL.
May 27 '17 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: sierra7 | last post by:
It seems Access 2010 is associating an 'input mask' or field type with a combo box when a form is opened, even though there is no Format setting on the control. I have a form which has been...
2
by: dougancil | last post by:
I have a user who had deleted some records from a database today using Access 2010. They have an ID field that's autonumbered. They have No Duplicates allowed. When they created a new record today,...
5
by: neelsfer | last post by:
I got a new work laptop last week with Access 2010 pre-loaded.I also installed the new Office 2010 service pack 1. I then loaded 2 of my regularly used Access 2007 + service pack 2 applications on...
4
beacon
by: beacon | last post by:
Hi everybody, My title may not exactly describe my issue, so please forgive my lack of creativity today. I've got a database that was created in Access 2003 that I've opened in Access 2010. I...
17
twinnyfo
by: twinnyfo | last post by:
Hey coders, Has anyone heard anything about the Date() function no longer working (or working differently in MS Access 2010? I have an MS Access 2007 DB that has worked perfectly, however, we...
1
by: newtoaccessvba | last post by:
I am not too familiar with VBA in Access, but I would like if someone could show me how to ignore a caption and it's field in an Access 2010 Report and an Outlook Email when the field value is it is...
5
by: Katie Howard | last post by:
I have an Access 2010 database and am using the feature of collecting data by email. I’m using the InfoPath form as the means of collecting the data. In general, it works well – but I’ve run into 2...
3
by: rahul2310 | last post by:
I want to disable function keys in access 2010,for that i am using code on forms on key down event. Code is 'The forms Key Preview property must be set to Yes Private Sub Form_KeyDown(KeyCode As...
2
by: irslan rafique | last post by:
Hi, I am creating a database using Access 2010 Web Database. I have two tables: 1-Maintbl with these fields: 1- Date 2- RTNo 3-DriverName 4- ConID 5-ConName 6- Zone 7-...
0
by: alexg | last post by:
This code below would change the mdibackground in ACCESS 2003 perfectly, based on a file name (small image) and fit it to window in background. Now in Access 2010 it does not work. The background...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.