problem code
Microsoft Office TrainingThe UK's Number 1 for Microsoft Office Training Sitemap add this page to your favourites/bookmarksBookmark page
 
view a printable version of this pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Access VBA Training and help » Problem with code

Problem with code

resolvedResolved · Low Priority · Version 2003

replyReplyTue 15 Dec 2009, 20:46Delegate Joanne said...

Problem with code

Hi I seem to keep getting and error with the code. It works fine if I copy and paste the code but when I type it in it stops at Me.lstNumbers.AddItem intCount. Can you see where I am going wrong please.

Option Explicit

Private Sub cmdNumbers_Click()
Dim intStart As Integer
Dim intFinish As Integer
Dim intCount As Integer

intStart = InputBox("Enter a number")
intFinish = InputBox("Enter a higher number")
intStart = intCount

Me.lstNumbers.RowSourceType = "Value"

Do While intCount <= intFinish

Me.lstNumbers.AddItem intCount
intCount = intCount + 1

Loop

Do Until intCount > intFinish

Me.lstNumbers.AddItem intCount
intCount = intCount + 1

Loop


End Sub

For upcoming training course dates see: Pricing & availability

replyReplyWed 16 Dec 2009, 00:04Trainer Simon said...

RE: Problem with code

Hi Joanne,

Thank you for your question.

The only mistake I can see is the rowsourcetype is a value list not a value.

I hope this resolves the problem. If not let me know.

Regards

Simon

replyReplyWed 16 Dec 2009, 08:09Delegate Joanne said...

RE: Problem with code

Hi Simon I put the "Value List" in and the code now runs but it does not start with the first number that I enter. If I type in 5 and the finish 8, it starts at 0? 012345678. Can you see where the code is wrong?
Thanks Jo

replyReplyWed 16 Dec 2009, 11:39Trainer Simon said...

RE: Problem with code

Hi Jo,

Thanks for the clarification.

This line of code needs to be changed:

intStart = intCount

This should be intCount = intStart as the intCount needs to hold the value of your starting input box which is intStart. That is why it keeps doing 0 to your finish number.

I hope this helps.

Regards

Simon

replyReplyWed 16 Dec 2009, 16:29Delegate Joanne said...

RE: Problem with code

Thanks Simon, I couldn't see for looking!! Makes sense now, once again thanks for your help
Jo

 

 

Please browse our web site to find out more about
access class microsoft training and other Microsoft training courses.

Access tip:

Combo box for finding records

You can use a combo box in a form to look up a record. If you place the comb box in the Form header, by then selcting they a field type from the drop down loist, you will see the record for it

View all Access hints and tips

forum postCan I order slides in a differnet set of sequence?

» Forum post: Navigation


Rate this page:
2.2/5 (213 votes cast)
Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses
Microsoft Certified Partner
Security Seal verified by visa, mastercard securecard

Mini sitemap. These are the main areas of our web site. Full sitemap.

Management training

Professional Skills courses
Project Management Course London
Project Management Courses London
Project Management Training London
Project Management Training
Project Seminar
Project Seminars
Time Management Course London
Time Management London
Time Management Courses London
Time Management Training London
Introduction to Finance course
Assertiveness Skills course
Effective Communications Skills training
Presentation Skills London

Training Formats

Public scheduled courses
On-site training
Closed company courses

Consultancy
Application Development

Blogs

Excel Training
MS Project Training
Microsoft Training Blog

Version differences

Office 2010 vs 2007
MS Project version differences

Training Information

London Computer Training
Computer Training London
Docklands Training Courses
Docklands Training London

Training venues London
Client list
FAQ
Pricing and availability
Course details / Syllabus

Training Articles
Training Information

Microsoft training

Microsoft Office training
& IT Applications

Microsoft Project training
Microsoft Outlook training
Microsoft Powerpoint training
Microsoft Word training
MS Project courses
MS Project training
Outlook courses
PowerPoint courses
PowerPoint training
VBA courses
Word courses
Microsoft.training
(more...)

Excel Training

Excel courses
Excel Training Courses Medway
Autonumber in Excel
Microsoft Excel training
Basic Excel Courses
Basic Excel Course
Basic Excel Training

Interested in MS Access training?

Access courses
Microsoft Access training
Microsoft access courses
Microsoft training access course
Microsoft+access+training
Access courses in london

Training provider

Training providers
IT training companies
IT training providers
Management Training providers
Management Training provider

Event history, feedback results
Events in 2012 · 2011 · 2010 · More

See also

Crystal Reports training