Keep getting "compile error--sytax error"

G

Guest

The debug stops on the first "Case Is = 1 to 20000" line:


Private Sub PopulationBracket_BeforeUpdate(Cancel As Integer)
Select Case Nz(CountyPopulation, CityPopulation)
Case Is = 1 to 20000
Result = 1
Case Is 20001 to 40000
Result = 1.5
Case Is 40001 to 100000
Result = 2.5
Case is 100001 to 200000
Result = 3
Case Else
Result = 3.5
End Select
Me.txtPopulationBracket = Result

Can you help? Thanks
 
G

Guest

Hi.
The debug stops on the first "Case Is = 1 to 20000" line:

Try the following syntax in your Select Case block:

Select Case Nz(CountyPopulation, CityPopulation)
Case 1 To 20000
Result = 1
Case 20001 To 40000
Result = 1.5
Case 40001 To 100000
Result = 2.5
Case 100001 To 200000
Result = 3
Case Else
Result = 3.5
End Select


HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)
Beware to those who use munged addresses: known newsgroup E-mail harvesters
for spammers are (e-mail address removed) and (e-mail address removed)

- - -
When you see correct answers to your question posted in Microsoft's Online
Community, please sign in to the Community and mark these posts as "Answers,"
so that all may benefit by filtering on "Answered questions" and quickly
finding the right answers to similar questions. Remember that the first and
best answers are often given to those who have a history of rewarding the
contributors who have taken the time to answer questions correctly.
 
B

Brendan Reynolds

Take out the 'Is' - it's only used when comparing strings, not numbers.

Don't ask me why - probably some hold-over from earlier versions of BASIC.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top