Another MS Access question....

Since it looks like some previous posters had luck asking questions about MS Access, I’m going to give it a shot, too.

I am trying to write a query that will return the remainder of an expression (5/2 would return 1). I know how to do this in Excel, but I can’t seem to figure out how to do this in an Access query. Can anyone help?

Thanks!

Use the MOD operator. 5 Mod 2 would return 1.

Example: SELECT * FROM [My Table] WHERE [Field1] Mod [Field2] = 0;

Libertarian,

Thank you for that answer. Is there a web page or a book or some other reference that I could use top answer other questions like this in the future? For example, now that I can perform the MOD function, I need to be able to regulate the number of decimal places the calculation is carried out to. I would be grateful for an answer to this question, but I am very interested in learning how to fish, rather than begging for lunch every day - know what I mean?

Thanks again for the quick and very helpful response!

Try this site, it’s a user group site that handles newbie to hardcore developer’s questions.
http://peach.ease.lsoft.com/archives/index.html
This one’s more for the beginner to moderate developer, but it’s still very good.
http://www.mvps.org/access/

There’s also The MSDN Library.

Thanks for the link, I have actually seen them before and even have one bookmarked already. I guess I’m just plain green when it comes to this application, because even using these refrences I am having a difficult time writing complex querries. Guess I’ll just have to steady on…

Thanks again for the help!

I want to format the result of my query so that it returns a whole number that is rounded down to the nearest whole number - i.e. a result of 51.84 will be 51. I know how to do this in Excel, but I can’t get it to work in Access. Also, I want the numbers to be in ## format (9.87 is 09) - can someone help?

Without knowing more about what you are trying to do, I can only give a general hint. Try:

SELECT Format(Int([Field1]/[Field2]),“00”) AS theResult FROM Table1;

Of course, replace the “/” with “Mod” or whatever operation you really need.

My suggestion to help you learn more about Access and queries, etc. is to spend a great deal of time reading the help file in Access. There are a wealth of examples in it and everything is indexed and searchable. Bury yourself in the help file for a few weeks, and I’ll bet you feel like an expert when you are finished.

Thanks Hardcore! Yes, I have been trying to bury myself in the help files - I only feel more confused when I look up. I looked for information regarding this for hours and couldn’t figure it out. How did you decipher this information from the Acess “help” files?

IMO, the absolutely best place for questions of this nature is Compuserve’s MS Developers forum: http://forums.compuserve.com/vlforums/default.asp?SRV=MSDevApps&LOC=us

John Vinson, Mark Liquorman, and others do an incredible job of answering Access questions ranging from the rediculous to the sublime.

I don’t know that I would spend time in the help files trying to learn Access (or anything else, for that matter) - that’s not what they are intended for. I would suggest exploring the sample files Northwind.mdb and Solutions.mdb. Depending on what was included during your installation of Access you may be able to let the Access wizards build up an entire database for contacts, or wine collection, etc. You can learn a lot just by working through those.

Aw, shucks heembo. Twern’t nothin’ :o:D I didn’t need the help file for this, since I do this type of thing all day every day.

I agree with bnorton that the MS Developers Forum is an excellent resource, and working through the example databases provided in Access provides another fantastic way of learning. But I have learned a great deal by plowing through the help file when I am stuck, or even when I am bored. The real key is that there are a LOT of resources available through various channels, so explore them all and find what works best for you.

bnorton wrote

I concur. In my experience, the Access help files not very useful, unless you have a very specific problem you want to solve like looking up function argument specifics.

Thanks to all who have responded to my questions. I truly appreciate the assistance and look forward to returning the favor every chance I get.

Heembo.