473,382 Members | 1,353 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Can't get Stephan Lebans save-restore-modify relationships to work

I downloaded Stephan's utility from his website but can't get it to
work - or maybe I'm not driving it properly!
The form works OK with the existing 3 "views" - I can switch between
them and they display changes fine.
But if I add or remove a table from any one of them, strange things
happen.
For example: start with a fresh copy of the downloaded database.
Open the form and click on the "Admin" view.
Right click and click on "Show Table"
Select CustomerSales and Add.
Close the Show Table Dialog box. You'll see the new table added to
the view.
Now try selecting another view, say RelationshipsView1.
On my machine, the new table is stuck on it too.
The same with RelationshipsView2, it is hidden behind customer_4.
Switch back to Admin view.
Assign a new name in the Unique Id text box and click to "Save the
current relationship layout".
Close and reopen the form. The change has disappeared!
If I saved the relationship window , the extra table does get saved,
but when you look at all the views, it's stuck on all of them again.
I guess I must be doing something horribly wrong, because I can't see
anyone else having these problems.

Although, looking at the code, it doesn't look like it's clearing the
relationship window before applying a new view - just repositioning
existing windows.
Would like to get it working - useful for large databases ...
TIA
Terry Bell
Aug 1 '08 #1
5 2091
What version of Access and Windows are you using?

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
<te**********@gmail.comwrote in message
news:a4**********************************@a3g2000p rm.googlegroups.com...
>I downloaded Stephan's utility from his website but can't get it to
work - or maybe I'm not driving it properly!
The form works OK with the existing 3 "views" - I can switch between
them and they display changes fine.
But if I add or remove a table from any one of them, strange things
happen.
For example: start with a fresh copy of the downloaded database.
Open the form and click on the "Admin" view.
Right click and click on "Show Table"
Select CustomerSales and Add.
Close the Show Table Dialog box. You'll see the new table added to
the view.
Now try selecting another view, say RelationshipsView1.
On my machine, the new table is stuck on it too.
The same with RelationshipsView2, it is hidden behind customer_4.
Switch back to Admin view.
Assign a new name in the Unique Id text box and click to "Save the
current relationship layout".
Close and reopen the form. The change has disappeared!
If I saved the relationship window , the extra table does get saved,
but when you look at all the views, it's stuck on all of them again.
I guess I must be doing something horribly wrong, because I can't see
anyone else having these problems.

Although, looking at the code, it doesn't look like it's clearing the
relationship window before applying a new view - just repositioning
existing windows.
Would like to get it working - useful for large databases ...
TIA
Terry Bell

Aug 1 '08 #2
Xp, Access 2003 - I think service pack 3 but not sure, I'm at home
now ...

Aug 1 '08 #3
Save the RelationShip view in Acccess before using my Tools to manipulate
the window.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
<te**********@gmail.comwrote in message
news:8f**********************************@n33g2000 pri.googlegroups.com...
Xp, Access 2003 - I think service pack 3 but not sure, I'm at home
now ...

Aug 2 '08 #4
Stephen I've tried your suggestion, it still doesn't seem to work
properly.

I've spent some time changing your test tables to illustrate the
problem, and I've set up a vb function to prepare the test data. If
you execute the vb code below against your download database, it will
do the following:
- Add a new table tblAddress(AddressId,Address)
- Delete all the current relationships (I've done this because you
have a few self-joins in there that complicate the display)
- Added new column Customer.AddressId as a foreign key to the new
address table.
- Added two relations
- one between Customer and CustomerSales, as you originally had.
I've made this a dbRelationDontEnforce type because your data won't
allow enforce.
- the other between tblAddress and Customer
-It also deletes the contents of tblRelationshipViews so we can start
with a clean plate.

To reproduce the problem:
1. Run the code
2. Open and clear the Relationship window.
3. Add all three tables to the window. They will show the relation
lines.
4. Save the Layout (as you suggested)
5. Open your form.
6. Enter Unique Id "AllThree" and click the Save button.
The layout seems to be saved OK
7. Now close the form and open the Relationships window again.
8. Delete one of the tables (eg tblAddress) and save the layout.
9. Leave the layout visble, we want to save this as a second view.
10. Open your form again.
11. Click on the "AllThree" view.

On my machine (incidentally - this one is Win2K and A2K) tblAddress
has disappeared.

Stephen I'm probably having a huge senior's moment over this - very
worrying - so please be patient - but it looks to me like the tool
doesn't seem to be handling different sets of tables correctly.
Changes in table positioning are OK.

I have a large database that I want to split into views for review and
this would be ideal.

Thanks for your time. By the way I've used lots of code from your
site over the years and have the greatest respect for your work -
you've saved me lots of time.

Terry Bell

'***Start code
Option Compare Database
Option Explicit

Function SetupTestConditions()
Dim Sql, rel As Relation, db As Database, fld As Field, tdf As
TableDef, i As Long

'Create new table tblAddress
Set db = CurrentDb()
Sql = "CREATE TABLE tblAddress (AddressId INTEGER CONSTRAINT
AddressIdPK PRIMARY KEY,Address TEXT)"
db.Execute Sql, dbFailOnError

'Delete existing relations, self joins complicate the display
For i = db.Relations.Count - 1 To 0 Step -1
db.Relations.Delete db.Relations(i).Name
Next

'Delete original test relationship diagrams from tblRelationshipViews
db.Execute "Delete from tblRelationshipViews", dbFailOnError

'Add column AddressId to Customer
Set tdf = db.TableDefs("Customer")
tdf.Fields.Append tdf.CreateField("AddressId", dbLong)

'Create relationship tblAddress to Customer
Set rel = db.CreateRelation("AddressToCustomer", "tblAddress",
"Customer", dbRelationUpdateCascade)
rel.Fields.Append rel.CreateField("AddressId")
rel.Fields!AddressId.ForeignName = "AddressId"
db.Relations.Append rel

'Create relationship Customer to CustomerSales.
'Don't try to enforce Ri, Customer 1 doesn't exist.
Set rel = db.CreateRelation("CustomerToCustomerSales", "Customer",
"CustomerSales", dbRelationDontEnforce)
rel.Fields.Append rel.CreateField("CustomerId")
rel.Fields!CustomerId.ForeignName = "CustomerId"
db.Relations.Append rel

MsgBox "Done"

End Function
'*** End Code
Aug 2 '08 #5
Stephen ... have you had a chance to look at this?
Aug 10 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Bruce Rusk | last post by:
I'm using Stephen Lebans' RTF2 control in a report, and have discovered what may be a slight bug in it. I have a lot of non-Western language (Chinese) text in my RTF field, and such records get...
18
by: Keith Brown | last post by:
I have an application that allows embedded storage of ANY chosen file in an OLE field. The file could have been dragged-and-dropped into the field or it might have been selected and imported...
8
by: Larry R Harrison Jr | last post by:
Sometime, if an error has occured or even if a user has answered NO to a MsgBox Y/N question, the Lebans calendar control will prevent the form from closing. I know the Lebans calendar control...
3
by: RAllsopp | last post by:
I have a client who would like to have several pictures associated with one system. I have read about storing only the pathname to save OLE overhead and have set-up a form for my client to...
5
by: Tom | last post by:
Hi: I'm using the Leban's ReportToPDF solution and have encountered a small problem. I'm calling the code using the following: Call ConvertReportToPDF(strReportName, , , True, True) Where...
6
by: serviceman via AccessMonster.com | last post by:
Hi again gang... I have downloaded a great little list box select form from Stephen Lebans that i would like to use in my student email project. The "available" object is populated thus: Private...
6
by: Tim Marshall | last post by:
Does anyone know if Stephen Leban's ConvertReportToPDF for converting mdb reports to pdf can be done for a print preview of a form? A major Access application I've developed and use displays an...
3
by: CuriousOne1 | last post by:
Hi all, I don't know if anyone has come accross this before. I've been using Steve Lebans Calendar control (available here: www.lebans.com/monthcalendar.htm ) for several database application...
4
by: limperger | last post by:
Hello everybody! I know some Access fundamentals but I have no idea about VBA code. As many people, I would like to have something to fix the mousewheel "effect" in Access forms. I have entered...
3
by: Paul Mc | last post by:
Hi all, I have been and still need to export some (1600) word docs from an OLE field. I have exported about 10% (office 2000) using Stephen Lebans OLE to disk... But...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.