Learning code

G

Guest

I've been having a really hard time trying to figure out how to get anything
but the simplest of codes to work. I've used code from people who swear up
and down it works, i try to use it and nothing happens. There's always some
kind of error.

Is there a manual or tutorial, or training program that's out there that can
help me understand code better so I'm not at the mercy of vba and access?
Please help.
 
S

Steve

Checkout Beginning AccessXXX VBA, Smith and Sussman, Wrox Press where XXX is
your version of Access.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)
 
G

Guest

Hi Freehal,

I'm certainly not against books....I bought several when I started
developing in Access almost a year ago. But another way is to download some
templates and check out some of their functionality and the code behind it.
There are at least around 10 or so templates you can download from MS for
free...

Just a thought,
CW
 
J

John W. Vinson

There are at least around 10 or so templates you can download from MS for
free...

Well... some of us are somewhat underwhelmed with the quality of the code in
these templates. Useful, but sometimes in the sense that you can learn what
not to do from a terrible example!

John W. Vinson [MVP]
 
S

StopThisAdvertising

Steve said:
Checkout Beginning AccessXXX VBA, Smith and Sussman, Wrox Press where XXX is
your version of Access.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)

--
Did you actually read that book Steve ??? Also understood the book ???

You are *not* a resource at all !!
Stop advertising here, or get lost for another year or so...
http://home.tiscali.nl/arracom/whoissteve.html

ArnoR
 
M

missinglinq via AccessMonster.com

Actually, it might not be a bad idea to get one of the Access for Dummies
type book! I say this because of your statement "I've used code from people
who swear up and down it works, i try to use it and nothing happens. There's
always some kind of error."

Most people (Little Stevie and his many aliases aside) who respond to posts
do know what they're talking about! The problem often is that the original
poster doesn't know enough of the basics, such as what a field is versus what
a control is or the difference between a form and a report, to state their
problem/question clearly. This is where the Dummies type books can help. I've
been programming for 17 years, and anytime I start out with a new programming
language that's the first thing I buy; ithey give you a good, basic grounding.


--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 
C

CS

Freehal04 said:
Is there a manual or tutorial, or training program that's out there that
can
help me understand code better so I'm not at the mercy of vba and access?
Please help.

Something that helped me was to design a macro that worked, then convert it
to vba and study the syntax and structure. This helped me understand what
vba was doing.

I also found that starting out with a specific task I wanted to actually
have work in my db was helpful (like refreshing a second field when another
field changed).

Two books that helped me (and that I still consult constantly) were Novalis'
Macro and VBA Handbook, and Beginning VBA (Smith and Sussman) -- but only
AFTER I had a good basic working knowledge of Access itself.

HTH
CS
 
T

tina

you make a very good point. newbies need to learn the basic names and uses
of Access objects, so they can use the proper nomenclature when asking
questions, and then better understand answers and instructions. talking
about a car by calling it a bicycle is bound to confuse your mechanic! ;)
 
C

Chris2

Freehal04 said:
I've been having a really hard time trying to figure out how to get anything
but the simplest of codes to work. I've used code from people who swear up
and down it works, i try to use it and nothing happens. There's always some
kind of error.

Is there a manual or tutorial, or training program that's out there that can
help me understand code better so I'm not at the mercy of vba and access?
Please help.

Freehal04,

All the other suggestions apply, however I will toss in some free references:

The following is true for MS Access 2000 (and I *think* also for 2002 and 2003).

You should open the Microsoft Access Help.

Switch to the Contents tab if you aren't already there.


Look down the list for two book-icons.

Programming Information

Open it, browse through it.

Basic Programming Concepts would be a good place to start.

The book-icons, Microsoft Jet SQL Reference, Visual Basic Conceptual Topics, and Visual
Basic Language Reference, can be good places to locate the answers to specific questions
(none are guides).

I wouldn't call these files the most friendly possible. However, they are right there on
your computer.

-------------------------

You can also search on your harddrive for a file named DNJET.chm. If you have it, this is
the Microsoft Jet Database Engine Programmer's Guide. It is unfortunate, but it seems to
have been written for JET 3.x (I have never located an updated version). Still, a great
deal of it applies to JET 4.0, and more of it is general in nature about how to use SQL
(where the Microsoft Jet SQL Reference just splats out syntax with some rules and
restrictions).

-------------------------

The Microsoft Developer's Network.

A lot of information to be found here.

This link is for Access 2007 Concepts:

http://msdn2.microsoft.com/en-us/library/bb149125.aspx

You can scroll down the menu to find Office 2003, XP, and 2000. There are sections under
each for MS Access.


Sincerely,

Chris O.
 
A

Arvin Meyer [MVP]

Freehal04 said:
I've been having a really hard time trying to figure out how to get
anything
but the simplest of codes to work. I've used code from people who swear
up
and down it works, i try to use it and nothing happens. There's always
some
kind of error.

This error handler might help some. Save it in a standard module and call it
like in the exanple below:

Public Function ErrorLog(objName As String, routineName As String)

Dim db As DAO.Database

Set db = CurrentDb

Open "C:\Error.log" For Append As #1

Print #1, Format(Now, "mm/dd/yyyy, hh:nn:ss") & ", " & db.Name & _
"An error occured in " & objName & ", " & routineName & _
", " & CurrentUser() & ", Error#: " & Err.Number & ", " &
Err.Description

Close #1
End Function
-------------------------------------------
Use it like this:

Sub MyExample()
On Error GoTo Err_Handler
' Your code here

Exit_Here:
Exit Sub

Err_Handler:
Call ErrorLog("frmMyForm", "MyExample")
Resume Exit_Here
End Sub
--------------------------------------------
It will create a file of errors on your C:\ Drive, named Error.log which
will tell you where, when, and where the errors are. The following code used
to be in the Access help files. It will build a table of Access and Jet
errors. Set a reference to DAO, (Do that for the code above too) and paste
this into a module:

Function AccessAndJetErrorsTable() As Boolean
Dim dbs As Database, tdf As TableDef, fld As Field
Dim rst As Recordset, lngCode As Long
Dim strAccessErr As String
Const conAppObjectError = "Application-defined or object-defined error"

On Error GoTo Error_AccessAndJetErrorsTable
' Create Errors table with ErrorNumber and ErrorDescription fields.
Set dbs = CurrentDb
Set tdf = dbs.CreateTableDef("AccessAndJetErrors")
Set fld = tdf.CreateField("ErrorCode", dbLong)

tdf.Fields.Append fld
Set fld = tdf.CreateField("ErrorString", dbMemo)
tdf.Fields.Append fld

dbs.TableDefs.Append tdf
' Open recordset on Errors table.
Set rst = dbs.OpenRecordset("AccessAndJetErrors")
' Loop through error codes.
For lngCode = 0 To 3500
On Error Resume Next
' Raise each error.
strAccessErr = AccessError(lngCode)
DoCmd.Hourglass True
' Skip error numbers without associated strings.
If strAccessErr <> "" Then

' Skip codes that generate application or object-defined errors.
If strAccessErr <> conAppObjectError Then
' Add each error code and string to Errors table.
rst.AddNew
rst!ErrorCode = lngCode
' Append string to memo field.
rst!ErrorString.AppendChunk strAccessErr
rst.Update
End If
End If
Next lngCode
' Close recordset.
rst.Close
DoCmd.Hourglass False
RefreshDatabaseWindow
MsgBox "Access and Jet errors table created."

AccessAndJetErrorsTable = True

Exit_AccessAndJetErrorsTable:
Exit Function

Error_AccessAndJetErrorsTable:
MsgBox Err & ": " & Err.Description
AccessAndJetErrorsTable = False
Resume Exit_AccessAndJetErrorsTable
End Function
 

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