How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask Richard Your Own Question
Richard, Software Specialist
Category: Microsoft Office
Satisfied Customers: 36526
Experience:  Over 15 year experience resolving Microsoft Office Issues
Type Your Microsoft Office Question Here...
Richard is online now
A new question is answered every 9 seconds

I need some guidance for Microsoft Access 2010, to create some

This answer was rated:

I need some guidance for Microsoft Access 2010, to create some simple programming statements to use in either reports, forms or queries. I have a 2000+ record DB created and now need to do some more complex programing to get the results I need. I have some skills in Access programming but I am a bit rusty. Could someone help with some programming statements and also some guidance regarding where best to use these snippets, queries, reports, etc?
Thank you for your question, my name is Richard.

I can help you with this.

What exactly would you like to achieve for functionality in the database?

Thank you
Customer: replied 3 years ago.
Relist: Answer came too late.
Hi Dave,

There is no answer I have given.

I asked you a question, but you may have missed this?

I will repeat it

"What exactly would you like to achieve for functionality in the database?"

Thank you
Customer: replied 3 years ago.


Sorry I though we missed each other and my timeline is getting tight.


I am an adequate Access user and have done many designs over the years. However I lack the programming skills to get the most out of queries, reports, etc., especially when the needs require some programming skills. I can sometimes adapt code that I see for my own needs, other times not. I can do simple macros sometimes and calculated fields when the math is moderate. I can usually get around simple queries ok until I need to use more complex functions. I am rusty as I have not done much with it in a few years.


I am a little confused if I should be doing my programing statements the query? Query is preferred.


This is a DB for rounds of golf played in a 2 yr. period. It has about 12 fields which I imported from another tournament tool my club uses. I have about 2100 rounds of golf with score, date, handicap, player name, course, score, slope, position, etc.


The need is to award fixed points for where the person finished in every tournament and then sum it. There are 5 places in most tournaments but for this exercise I need to assign points to the 1st, 2nd, 3rd position.


I have a number field called “position”, for each golfer in 30-40 tournaments which is the place the golfer finished. I need to automate a process in which for each position, Access will assign a fixed # XXXXX points for each position but only positions 1, 2, 3.


For each position 1 the player should accumulate 3 points. For each position 2, accumulate 2 points and of each position 3 accumulate 1 point. And get a sum for each person.


What is the best way of handling this?


Thx Dave

ok, you want to use a query when possible, there easier to make and maintain. But it is not always possible.

It depends on the data flow eg: Are you inputting it via a form, or importing it direct to the Tablet.

If you are importing it directly into the Table, you will then want to run an update query to update the values.

Else if you input it via a form, you would use an event trigger (a macro on the after update event when inputting the data).

So the question is, how does the data get into your database?

Customer: replied 3 years ago.

I imported all of the fields from a custom report I created in the other tournament tool we have. I exported to Excel and then appended it into the DB. I had to do this about 40 separate times, one time for each tournament.

ok, then create an update query, and do it this way Dave.

Have you created these before?

Customer: replied 3 years ago.

Yes, I have created update queries. There are no examples in your last message after "do it this way Dave". What am I updating and why, if you don't mind?


Of course not, and working on your explanation, you would update by using a query like the below

For 1st place you would use this

UPDATE tblPlayers
SET [Points] = 3,
WHERE [positionFinished] = '1'

You would then create a second query for 2nd place

UPDATE tblPlayers
SET [Points] = 5,
WHERE [positionFinished] = '2'

And for third place the following

UPDATE tblPlayers
SET [Points] = 3,
WHERE [positionFinished] = '1'

I am just using pseudo query, but it demonstrates how the update queries are created, which you would run after the importing of data.

Then you would have another query that does the summing this way.

Select Player, Sum(Points) as TotalPoints from tblPlayers group by Player

This will then show the total points per person.

Please let me know Dave if you need clarification on any points.

Customer: replied 3 years ago.

That seems like a good approach. Will it create a new field in the table named Points?


My table name is XXXXX XXXXX I suspect I would replace tblPlayers with tblMain as I run the update queries?

No, you need to make the field Points, a query will never make fields

Correct on that, except not tbl

You would just use Main (as this is the tables name)
Customer: replied 3 years ago.

Ok, I see if I can put this together. I would like a field in table Main that contains the points after the update query. Then I can make a calculation field in Main which will add the points together.


Any thoughts as I import new data after each tournament, maybe 1-2 x monthly. Will I need to keep using the update query?


Maybe one more thing: How do I count the number of times a person appears in the DB? I also need to count the # XXXXX tournaments they played in, which would come from their many records in the DB?


You dont save the calculation field in the table, you never do, just calculated it when presenting the data.

else yhou would need an update query for this as well, but thet de-normalises the data, so you want to avoid this.

You will need to run the query everytime that you add the data, as you need to update it again.

To count the amount of times a person appears, you would use this query

SELECT Count(Player) AS CountOfPlayer
FROM main
GROUP BY Player;

This will show each player and how many times they appear David.

Let me know if this makes sense please.

Thank you
Customer: replied 3 years ago.


I am getting syntax errors on both of these. Tried a few changes, no luck. Here is what I did. I am using Access 2010 btw.


Did you want me to use an actual update query or a std query? Tried both. Opened a std query. Opened the "Expression Builder". The builder approach puts all of this into the field line in the query. I created a field in Table Main for Points.


Typed in the following:


UPDATE (tblMain)
SET ([Points] = 3,
WHERE [Fltpos] = '1'


Ran the query and kept getting syntax errors. Tried moving the paran around, etc.


Did I do this correctly?





Hi Dave,

Sorry I was offline.

You have an unopened bracket, this is the problem

UPDATE (tblMain)
SET ([Points] = 3,
WHERE [Fltpos] = '1'


UPDATE (tblMain)
SET [Points] = 3,
WHERE [Fltpos] = '1'

Also make sure your Main table is indeed called tblMain (I believe you said it was Table)?

Let me know the results please

Thank you
Customer: replied 3 years ago.


Still getting invalid syntax errors. I have tried multiple different approaches. All in one line, in three lines, just as you offered. I deleted that open paren. Still general syntax error


This update statement is not going to change the data in Fltpos, correct?


SET [Points] actually does what? Does this create a new field in the query so that we are not modifying the data in Fltpos? I need to have this data unchanged as I may have to experiment with the # XXXXX points for awhile.


The Fltpos is defined as a numeric field,FYI. Still need " 1"


Thx Dave

ok, I will break down the statement.

First, SET [Points] is what sets the value to the Points Field.

This you need to create in the Database, like any field you create to store data.

WHERE [Fltpos] = '1'

This is the Where condition. Basically like an if statement. If does not change Fltpos but checks it.

Look at it like this normal if statement

if fltpos = 1 then set the value of Points to 1

this is in effect what your update query is doing.

Let me know if you have any difficulties please

Customer: replied 3 years ago.

Yes, great, thank you. That is what I want to do.


I have a field in Main named Points and is set to numeric.


The complete statement still has invalid syntax.


Thx Dave




ok, its best for me to look at the database Dave.

- Click the following link:
- Upload the file to that website
- Once it is uploaded, the resulting page will display a "File ID" number.
- Please, give me that "File ID Number"

Thank you
Customer: replied 3 years ago.

Ok Richard,

File ID is 545262


Don't know why the size of this test version is about 1/3rd the size of the production version. It looks like it has all of the data. I tried the query in a few versions and same syntax error - operator with no operand.


Thx Dave




oko, I want to avoid (unless you say so) just doing this for you, as I can see you want to learn this.

First, which query have you been working on?

Customer: replied 3 years ago.

It would not save it because of the syntax error, so it is not present. It was a new query with just that one statement in it.


Go ahead and create. I was wondering should I be putting the content into the expression builder , which goes into the first line of a query or should I be putting it into the SQL

ok, I see the issue

I have done the first one, download it from


Let me know how you go making the second one please.

Customer: replied 3 years ago.

Thanks Richard! You had the points distribution wrong but I fixed it Wink

I tried to add the other two situations into the same query but it didn't like it.


Do I have to create three independent queries to update the three different point arrangements?


Couldn't we just create an IIF statements that will update Points?

Like this, just not sure of the syntax and also how to add a CREATE command if we can.


IIF Fltpos=1, 3, Null, IIF Fltpos=2, 2, Null, IIF Fltpos=3, 1, Null



yes, you have to have three independent queries Dave,

No on the code, in a Query, you are updating based on a condition, and this update needs to work off one condition.

This is why you need the three queries.

sorry about the points, but I was going off your statement

"For each position 1 the player should accumulate 3 points. For each position 2, accumulate 2 points and of each position 3 accumulate 1 point. And get a sum for each person."

Maybe I mis understood this?

But make the second and third query and let me now how you go please.

Thank you
Customer: replied 3 years ago.

Hi Richard,


Thanks that worked ok, created the other two update queries and it is doing what I wanted. Can you explain why you went from an SQL statement to simply using the update query?

I didn't Dave.

The SQL statement is an update query.

Your just viewing the code as a graphical representation, in design view, which is a feature of MS Access.

It is SQL code I used.

To explain, SQL is the Language for Queries. It is like English, or Chinese.

With SQL, you can do a lot, but the basics are

Select and view data
Delete Data
Update Data
Add Data

Theres are the 4 main uses of the SQL language.

We together used it to Update Data. The entity that SQL resides in is referred to as a query.

Does that make sense?

Customer: replied 3 years ago.

Yes, I guess it does make sense. The query is a graphical representation for ease of use and it actually builds the SQL which does the work, is that right?


You have been great to work with Richard. Thanks for all of the info and your patience.


Where are you located east coast US or further east of that? I am in Calif

Yes that is right. Microsoft best value to IT has been graphical representation of complex things.

I have also enjoyed working with you Dave.

I am located in the Netherlands. The land of Windmills and Cheese, though spent quite a lot of time in the past in Foster City, Milpitas, San Jose and a few other places in California.

If you need anything else ever in the future, feel free to let me know.

If you would like any additional information or assistance, please do not hesitate to let me know.

And if you can take a second to rate my service, that would be greatly appreciated.

Thank you
Richard and other Microsoft Office Specialists are ready to help you
Customer: replied 3 years ago.

Thanks again! I live near Foster City, in Belmont, just south of San Mateo. I have been in the computer field for many years, mostly in a sales/management capacity. I sell professional services to IT for many years. Many large projects to large companies in the Bay Area in the $1M plus sized jobs. Between jobs at the moment but expect to ramp up my search now that summer is just about over.


This is a project for the golf club I belong to in San Mateo. I am the Handicap Director and we are using this tool along with others to manage members scores.


I'll drop you an email or re-connect through Answer if I need anything else.


Thx Dave

Thanks Dave,

Can't say which company I worked in Foster City, but I would put money on it we met up once if you sold in the area at that range.

Looking forward to our next interaction.

Customer: replied 3 years ago.

Let's see if I can guess.....Foster City...Visa, Sprint, Franklin Resources, Gilead Sciences, Electronics For Imaging, maybe Sony, Applied Biosciences??? Did I get close?

some of the above :)

Take care Dave

Customer: replied 3 years ago.

Have a nice rest of the summer!

You take care as well.



Related Microsoft Office Questions