how do I fix the error in the genealogy database downloaded from .

S

spuddi

I downloaded the genealogy database template from the office wesite for
access 2000.
When I go to "add parent" or "add as spouse" i get an error message "compile
error"
how do I fix this?
 
T

Tom Wickerath

Spuddi,

Can you provide a link, so that others can find the same sample? I just spent the last 15
minutes on a fruitless search for the genealogy database from the Office website. There are many
problems that can cause compile errors, and you really haven't provided enough information, so I
thought I'd see if I could reproduce the compile error. But that means finding the *&$%^ sample!

In the meantime, try hitting ALT F11 to open up the Visual Basic editor. Then click on Tools >
References...
Do you see any references marked as MISSING? If so, these need to be fixed. See the following
papers on this topic:

http://members.rogers.com/douglas.j.steele/AccessReferenceErrors.html

http://members.iinet.net.au/~allenbrowne/ser-38.html

Close the references dialog and then try clicking on Debug > Compile DatabaseName. This should
locate the problematic code. The solution will obviously depend on the problem....which none of
us can see at the moment unless one has located this download. If you locate the compile error,
please post back with the entire procedure (subroutine or function) included in your reply.

Tom
________________________________


I downloaded the genealogy database template from the office wesite for
access 2000.
When I go to "add parent" or "add as spouse" i get an error message "compile
error"
how do I fix this?
 
B

Brendan Reynolds

Don't be surprised. The standard of the templates is, unfortunately, not
good. The template in question does not use Option Explicit. Microsoft's own
Office XP Developer's Guide calls this 'a serious mistake'. The Office 2000
Developer's Guide put it a bit more bluntly, calling it 'a coding blunder of
the highest order'. This template is a good example of why the Office 2000
Developer's Guide was right - the template code includes the following
undeclared constants and variables, all in the 'Module1' module:
ccHourglass, ccDefault, strSubType, and tvwChild.

As far as I can tell, however, I don't think any of the code that uses these
undeclared constants and variables is called from the Click events of the
two command buttons you mentioned, so it seems they may not be the cause of
your immediate problem (though they will certainly cause problems if you
need to import GED data). I notice that the VBA project has a reference to
the Microsoft Windows Common Controls 6.0 (SP6) library, which it does not
appear to actually use. You could try removing that reference.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
S

spuddi

Brendan,
Thanks for the info
I have tried to remove the refernces that get highlighted by the visual
basic debugger, but I am no good with the syntax to stop an error message
appearing

any thoughts on how?

Ian
 
B

Brendan Reynolds

I'm not sure that you understood what I meant about a reference.

I've reported the problems via the feedback link at the template site, so
one option would be to wait a while and see if they fix it. I've no idea
whether they will, or how long it might take if they do, though.

If you don't want to wait, then ...

If you have deleted or modified any of the code in the template, either
revert to a backup copy, or re-download from the template site. Then open
the MDB while holding down the Shift key, to by-pass the opening of the
startup form. Go into the VBA editor (Hold down the Ctrl key while pressing
the 'g' key) and select References from the Tools menu. Uncheck the box
beside the item that says Microsoft Windows Common Controls 6.0 (SP6). If
you like, you can also uncheck the one that says OLE Automation. That one
doesn't appear to be needed either. In my experience, though, that one is
less likely to be the cause of your problem. Don't uncheck any of the others
that are checked, the code won't work without them.

If you need to import data from GED files, or any other features that might
depend on the code in the 'Modules1' module, you'll also need to fix the
problems I mentioned with undeclared constants and variables in that module.
I'm not familiar enough with the template to advise you on how to do that.

Meanwhile, if the VBA editor is highlighting lines of code, post here
describing the line that is highlighted and the error message, and I may be
able to help.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
S

spuddi

I've unselected the common controls 6.0 and the ole but the add parent still
gives the error message " compile error: Method or data member not found"
when It tries to open the families form. the code is below
------------------------------------------------------------------------

Private Sub Form_Load()
Dim rstFamilies As New ADODB.Recordset

If Me.lblID.Caption = "placeholdertext" Then
Me.lblID.Caption = "###"
Me.lblIndividual.Caption = "no one selected"
End If

rstFamilies.Open "SELECT Families.[GED Family ID], Fathers.[Full Name],
Mothers.[Full Name] " & _
"FROM (Families " & _
"LEFT JOIN Individuals " & _
"AS Fathers " & _
"ON Families.[Father ID] = Fathers.ID) " & _
"LEFT JOIN Individuals " & _
"AS Mothers " & _
"ON Families.[Mother ID] = Mothers.ID;", CurrentProject.Connection,
adOpenStatic, adLockReadOnly

Me.cmbParents.AddItem "ID;Father;Mother"
With rstFamilies
Do Until .EOF
Me.cmbParents.AddItem ![GED Family ID] & ";" & _
.Fields("Fathers.Full Name").Value & ";" & _
.Fields("Mothers.Full Name").Value
.MoveNext
Loop
End With

End Sub
----------------------------------------------------------
the highlighted text is the .AddItem
from the line

Me.cmbParents.AddItem "ID;Father;Mother"

________________________________________

regards

ian
 
D

Dirk Goldgar

spuddi said:
the highlighted text is the .AddItem
from the line

Me.cmbParents.AddItem "ID;Father;Mother"

Seems to me that the AddItem method wasn't added to combo and list box
controls until Access 2002. If I'm right, then this code won't work in
Access 2000. Did the template you downloaded say that it was for Access
2000?
 
B

Brendan Reynolds

I just double-checked the link
(http://office.microsoft.com/en-gb/templates/TC010765241033.aspx?CategoryID=CT063459251033)
and yes, it is supposed to be for Access 2000, and yes, it really does
attempt to use the AddItem method of a combo box.

You know what's really weird? 15 users have given it an average rating of 4
1/2 out of a possible five! I guess they must have voted before they
actually tried to use it.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
J

Jeff Conrad

Either that or they downloaded it onto a machine with 2002 or 2003.
:)

This must be a fairly new template because I do not ever recall seeing it before and I thought I had
already downloaded all the MS templates.
 
B

Brendan Reynolds

The template gallery seems to filter results depending on the language ID
reported by the browser. You get different results depending on whether your
browser indicates you're using EN-US, EN-GB, etc.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
B

Brendan Reynolds

I'm afraid the bottom line is that this template is just plain broken, Ian.
If you are interested in learning about Access and VBA, fixing it might be
an interesting exercise. But if you are looking for a genealogy app you can
use as-is, I'd look elsewhere.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


spuddi said:
I've unselected the common controls 6.0 and the ole but the add parent
still
gives the error message " compile error: Method or data member not found"
when It tries to open the families form. the code is below
------------------------------------------------------------------------

Private Sub Form_Load()
Dim rstFamilies As New ADODB.Recordset

If Me.lblID.Caption = "placeholdertext" Then
Me.lblID.Caption = "###"
Me.lblIndividual.Caption = "no one selected"
End If

rstFamilies.Open "SELECT Families.[GED Family ID], Fathers.[Full Name],
Mothers.[Full Name] " & _
"FROM (Families " & _
"LEFT JOIN Individuals " & _
"AS Fathers " & _
"ON Families.[Father ID] = Fathers.ID) " & _
"LEFT JOIN Individuals " & _
"AS Mothers " & _
"ON Families.[Mother ID] = Mothers.ID;", CurrentProject.Connection,
adOpenStatic, adLockReadOnly

Me.cmbParents.AddItem "ID;Father;Mother"
With rstFamilies
Do Until .EOF
Me.cmbParents.AddItem ![GED Family ID] & ";" & _
.Fields("Fathers.Full Name").Value & ";" & _
.Fields("Mothers.Full Name").Value
.MoveNext
Loop
End With

End Sub
----------------------------------------------------------
the highlighted text is the .AddItem
from the line

Me.cmbParents.AddItem "ID;Father;Mother"

________________________________________

regards

ian

Brendan Reynolds said:
I'm not sure that you understood what I meant about a reference.

I've reported the problems via the feedback link at the template site, so
one option would be to wait a while and see if they fix it. I've no idea
whether they will, or how long it might take if they do, though.

If you don't want to wait, then ...

If you have deleted or modified any of the code in the template, either
revert to a backup copy, or re-download from the template site. Then open
the MDB while holding down the Shift key, to by-pass the opening of the
startup form. Go into the VBA editor (Hold down the Ctrl key while
pressing
the 'g' key) and select References from the Tools menu. Uncheck the box
beside the item that says Microsoft Windows Common Controls 6.0 (SP6). If
you like, you can also uncheck the one that says OLE Automation. That one
doesn't appear to be needed either. In my experience, though, that one is
less likely to be the cause of your problem. Don't uncheck any of the
others
that are checked, the code won't work without them.

If you need to import data from GED files, or any other features that
might
depend on the code in the 'Modules1' module, you'll also need to fix the
problems I mentioned with undeclared constants and variables in that
module.
I'm not familiar enough with the template to advise you on how to do
that.

Meanwhile, if the VBA editor is highlighting lines of code, post here
describing the line that is highlighted and the error message, and I may
be
able to help.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible
for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
T

Tom Wickerath

Hi Spuddi,

Thanks for providing the link. I just downloaded the sample database. It compiles okay in Access
2002, but when I try to open it in Access 2000 and compile it, the first compile error I hit was
on the following line of code in the GetGEDFile form:

Private Sub Form_Load()
On Error GoTo Err_Form_Load

Dim fDialog As Office.FileDialog <-----

A little quick research confirms Dirk Goldgar's suspicion that this template will not work in
Access 2000. The KB article titled:

How to display and use the file dialog box in Access 2002
http://support.microsoft.com/?id=279508

includes the following statements:
"This article shows you how to use the new FileDialog method in Microsoft Access to display the
built-in file dialog box and to determine what files the user selected."

and

"In earlier versions of Microsoft Access, you could not display the file dialog box without using
either the Microsoft Common Dialog ActiveX Control or by making calls to the Windows API."

So, you'd have to re-write the code in Access 2000 or wait and hope that someone at Microsoft
will fix this sample.


Tom
________________________________

Tom,
the link is


http://office.microsoft.com/en-gb/templates/TC010765241033.aspx?CategoryID=CT063459251033

I'm surprised that a template that MS provides is coming up with an error.

Thanks
Ian (spuddi)
 
S

spuddi

Thanks, guys I'll either try to get 2002/3 or I'll try to make one my self,
i've never done much before apart from creating a simple one for addreses and
telephone numbers.

I'll have a read and try to work out how to link people as fathers and
spouses.
My simple one means that you can use a combo box to add the autogenrated
uniqueID of one person as the spouseID of another, hoever it doesn't
automatically add the corresponding sposueID on the other's record.

I guess its to do with the relationships tool but can't get my head round
it. Ah well thats what learings about

Cheers
everyone
 
Top