Basic Programming question

Maxine1010

Registered User.
Local time
Today, 01:29
Joined
Jun 28, 2002
Messages
25
Hi,

I'm currently trying to learn Access VBA programming but the book that I'm learning from (which looked good at the timeI bought it) mentions several functions that don't actually work in Access 2000. I would be really grateful if someone could answer some very basic questions before I burn the thing!!!

What replaces AddItem/ RemoveItem in Access 2000? and, for example, how would the following code work in Access 2000:-

Sub Form_Load()

lstFruits.AddItem "Apples"
lstFruits.AddItem "Oranges"

and also the Date function. How do you show the system's current date in a message box. I'm told it is:

MsgBox Date

but this obviously does not work...

Solving these very basic questions would relieve me of great frustration - please help!!!.....
 
Maxine1010, .AddItem is a method that adds items to combo and listboxes in Visual Basic, but does not work in Access. Are you sure that book is for Access and not just VB?

Also MsgBox Date should work. It works in Access XP (I just tried it) and I can't think of why it wouldn't work in Access 2000. What error message do you get when it you try to run that code?
 
The code you have posted applies to the listbox in Visual Basic and not Visual Basic for Applications.

Code:
lstFruits.AddItem "Apples"

In Access the listbox gets its values from one of three places:

A Table or a query, a Value List, or a Field List.

We can elimate the latter for now.

Now, a listbox in Access can be set list (Value List) but, as is more typical, it wil get its information from a table.

Since you are using Access 2000, it would be best to look up ADO programming which will allow you to input information into a table and then requery the listbox.

Or, if you want to Add a simple Item with a Value List you can use the syntax.

Code:
Me.lstFruits.RowSourceType = "Value List"
Me.lstFruits.RowSource = Me.lstFruits.RowSource & ";Apples"

Are you sure the book was for Access 2000 and not VB?
 
Thanks,

yeah the books called 'Microsoft Access VBA Programming' and states on the front 'Covers Access 2002'. Up to now I've been working with it fine but I'm now coming across more and more things that don't work such as conversion functions....aarrgghh...

I thought I was just beginning to get the hang of it too..

I've looked at the postings regarding good books but the Developers Hand book looked a little advanced for me.

Looks like it's back to the shop at the weekend and find something else - any recommendations for very basic Access programming??
 
sorry I forgot, the error message I get with the date function in the message box goes something like this:

'The expression On Click you entered as the event property setting produced the following error: A problem occurred while Micorosft Access was communicating with the OLE server or Active X Control'

.......?
 
Beginning Access 2000 VBA from Wrox Press.

I like their books (currently reading Beginning Visual C++ Programming) as the books are tutorials and are built with logical maps at the back which give guidance as to your potential next steps (i.e. which book of theirs to buy next)
 
Maxine1010 said:
sorry I forgot, the error message I get with the date function in the message box goes something like this:

'The expression On Click you entered as the event property setting produced the following error: A problem occurred while Micorosft Access was communicating with the OLE server or Active X Control'

.......?
Search here for missing references
 
Is it? I had no idea - never read it myself. I had the Beginning Access 97 Programming one - it was okay. I was just guessing it was the same book with maybe some of the text updated to include ADO rather than DAO, and some other A2000 stuff (DAPs, etc...)

Sorry. :(
 
Any other book suggestions?

Also I've searched for mssing references, and found the references in the programme but how do I know which of mine are missing?
 
Maxine1010 said:
Any other book suggestions?

Also I've searched for mssing references, and found the references in the programme but how do I know which of mine are missing?
Any missing should be listed as Missing.

Is it? I had no idea - never read it myself. I had the Beginning Access 97 Programming one - it was okay. I was just guessing it was the same book with maybe some of the text updated to include ADO rather than DAO, and some other A2000 stuff
I too have the book and have only looked at it once or twice, there is very little on ADO in it. Somebody who'd bought the same book came here about a year ago and complained about the number of errors.:mad:
 
Maxine1010, too bad you got stuck with a bum book with mistakes in it. That's the last thing you need when you're trying to learn something. You're right about the Developers Handbook not being for beginners; it's for intermediate to advanced users. I really can't suggest any beginner books because the only book I used at the beginner level was the very thin book that Microsoft shipped along with Access 2.0 (I can't even locate it anymore).
 

Users who are viewing this thread

Back
Top Bottom