-
WSaral
AskWoody LoungerDecember 22, 2003 at 12:40 pm in reply to: Copy table structure only with RunSQL (Access 2000) #760387thank you for your suggestion it suits me perfectly
-
WSaral
AskWoody LoungerDecember 22, 2003 at 12:40 pm in reply to: Copy table structure only with RunSQL (Access 2000) #760388thank you for your suggestion it suits me perfectly
-
WSaral
AskWoody LoungerIt works so nice now !! About the order details table, how can i add the composite key in the table order details through code?I can only do it
for the first key, but Access does not allow me to put the second key.Perhaps there is
a command for the composite key?dbs.Execute “ALTER TABLE [order details] ADD CONSTRAINT PrimaryKey Primary Key(orderID);”
dbs.Execute “ALTER TABLE [order details] ADD CONSTRAINT PrimaryKey Primary Key(ProductID);” -
WSaral
AskWoody LoungerIt works so nice now !! About the order details table, how can i add the composite key in the table order details through code?I can only do it
for the first key, but Access does not allow me to put the second key.Perhaps there is
a command for the composite key?dbs.Execute “ALTER TABLE [order details] ADD CONSTRAINT PrimaryKey Primary Key(orderID);”
dbs.Execute “ALTER TABLE [order details] ADD CONSTRAINT PrimaryKey Primary Key(ProductID);” -
WSaral
AskWoody LoungerThank you very much for your advice which i followed again sucessfully.
I wonder could you help me with a specific table called order details.
This table lies between the tables “orders” and the table “products”.
The two functions seem not to work together and mostly the link between products and order details is not realised, and i get only the link between orders and order details.
The table order details contains no primary key, although my colleagues say
i should have two primary keys, for orderid and for productid.Is it so?
My question is, how get i get both functions work?Public Function LinkProductsAndOrderDetails()
Set rel = db.CreateRelation(“CustomerIDRelationship”, “products”, “order details”, dbRelationUpdateCascade + dbRelationDeleteCascade)
rel.Fields.Append rel.CreateField(“ProductID”)
rel.Fields!Productid.ForeignName = “ProductID”
‘ Append relation
db.Relations.Append rel
End Function
Public Function LinkOrdersAndOrderDetails()
Set rel = db.CreateRelation(“CustomerIDRelationship”, “orders”, “order details”, dbRelationUpdateCascade + dbRelationDeleteCascade)
rel.Fields.Append rel.CreateField(“OrderID”)
rel.Fields!Orderid.ForeignName = “OrderID”
‘ Append relation
db.Relations.Append rel
End Function -
WSaral
AskWoody LoungerThank you very much for your advice which i followed again sucessfully.
I wonder could you help me with a specific table called order details.
This table lies between the tables “orders” and the table “products”.
The two functions seem not to work together and mostly the link between products and order details is not realised, and i get only the link between orders and order details.
The table order details contains no primary key, although my colleagues say
i should have two primary keys, for orderid and for productid.Is it so?
My question is, how get i get both functions work?Public Function LinkProductsAndOrderDetails()
Set rel = db.CreateRelation(“CustomerIDRelationship”, “products”, “order details”, dbRelationUpdateCascade + dbRelationDeleteCascade)
rel.Fields.Append rel.CreateField(“ProductID”)
rel.Fields!Productid.ForeignName = “ProductID”
‘ Append relation
db.Relations.Append rel
End Function
Public Function LinkOrdersAndOrderDetails()
Set rel = db.CreateRelation(“CustomerIDRelationship”, “orders”, “order details”, dbRelationUpdateCascade + dbRelationDeleteCascade)
rel.Fields.Append rel.CreateField(“OrderID”)
rel.Fields!Orderid.ForeignName = “OrderID”
‘ Append relation
db.Relations.Append rel
End Function -
WSaral
AskWoody LoungerI am very happy and successful with my new function.Actually i use it for remote database and not for the current.
I wonder could i further simplify it. I use different functions for relating different tables.I see that i always repeat dimming the db , the password,
and i always open the database in one and the same place, named by me as Bepath.
Is it possible to refer to these as constant or as a separate function,
and then to remain only the settings of the relations?Below is my whole function
On Error Resume Next
Dim db As DAO.Database
Dim wsp As DAO.Workspace
Dim StrPassword As String
StrPassword = “classified”
Set wsp = DAO.DBEngine.Workspaces(0)
Dim rel As DAO.Relation
Set db = wsp.OpenDatabase(BEpath, False, False, “;PWD=” & StrPassword)Note : i repeat the above lines in all my other functions
‘ Create one relation with attibutes added together
Set rel = db.CreateRelation(“ClientIDRelationship”, “TblClients”, “CallsClients”, dbRelationUpdateCascade + dbRelationDeleteCascade)
‘Set join fields
rel.Fields.Append rel.CreateField(“ClientID”)
rel.Fields!Clientid.ForeignName = “ClientID”
‘ Append relation
db.Relations.Append rel
‘ Clean up
Set rel = Nothing
Set db = Nothing
End Function -
WSaral
AskWoody LoungerI am very happy and successful with my new function.Actually i use it for remote database and not for the current.
I wonder could i further simplify it. I use different functions for relating different tables.I see that i always repeat dimming the db , the password,
and i always open the database in one and the same place, named by me as Bepath.
Is it possible to refer to these as constant or as a separate function,
and then to remain only the settings of the relations?Below is my whole function
On Error Resume Next
Dim db As DAO.Database
Dim wsp As DAO.Workspace
Dim StrPassword As String
StrPassword = “classified”
Set wsp = DAO.DBEngine.Workspaces(0)
Dim rel As DAO.Relation
Set db = wsp.OpenDatabase(BEpath, False, False, “;PWD=” & StrPassword)Note : i repeat the above lines in all my other functions
‘ Create one relation with attibutes added together
Set rel = db.CreateRelation(“ClientIDRelationship”, “TblClients”, “CallsClients”, dbRelationUpdateCascade + dbRelationDeleteCascade)
‘Set join fields
rel.Fields.Append rel.CreateField(“ClientID”)
rel.Fields!Clientid.ForeignName = “ClientID”
‘ Append relation
db.Relations.Append rel
‘ Clean up
Set rel = Nothing
Set db = Nothing
End Function -
WSaral
AskWoody LoungerMany thanks. Just to let you know that my db works perfectly now ! Vey grateful about that.
-
WSaral
AskWoody LoungerMany thanks. Just to let you know that my db works perfectly now ! Vey grateful about that.
-
WSaral
AskWoody Loungeri beg to be apologized.Actually i wanted to open the form F2 only through the form main, and not to allow the form F2 to be opened
by itself. Is there any simple method to do it ?Maybe to put something in the record source ?Best regards
-
WSaral
AskWoody Loungeri beg to be apologized.Actually i wanted to open the form F2 only through the form main, and not to allow the form F2 to be opened
by itself. Is there any simple method to do it ?Maybe to put something in the record source ?Best regards
-
WSaral
AskWoody LoungerThank you so much for your detailed reply. I know that the fault is mine.I didnt explain in full what i need.
I still cannot make my report working.In the Sorting and Grouping window
i have put:
SumOfLiters – descending
ProductID – ascendingThe report so obtained give me a nice view for the totals of all products. However, it does not list the products according to the the total quantity
sold. This quantity is not SumOfLiters,but the sum of it.to be found in the ProductID footer and is :
=Sum([SumOfliters])Therefore, what i want is to arrange my products in descending order
not according their SumOfLiters, but according to their =Sum([SumOfliters])
which is in the report footer and giving summarized quantity of the each product.
Is it possible to put that =Sum([SumOfliters]) in the Sorting and Grouping window?.
I have tried, but it says that i have an extra bracket which is not true -
WSaral
AskWoody LoungerThank you so much for your detailed reply. I know that the fault is mine.I didnt explain in full what i need.
I still cannot make my report working.In the Sorting and Grouping window
i have put:
SumOfLiters – descending
ProductID – ascendingThe report so obtained give me a nice view for the totals of all products. However, it does not list the products according to the the total quantity
sold. This quantity is not SumOfLiters,but the sum of it.to be found in the ProductID footer and is :
=Sum([SumOfliters])Therefore, what i want is to arrange my products in descending order
not according their SumOfLiters, but according to their =Sum([SumOfliters])
which is in the report footer and giving summarized quantity of the each product.
Is it possible to put that =Sum([SumOfliters]) in the Sorting and Grouping window?.
I have tried, but it says that i have an extra bracket which is not true -
WSaral
AskWoody LoungerI do not know, you may be right,but it works with updating and also in all other cases. I cannot explain myself why my command does not delete.Also,my command does not work or delete with a linked table even in the current database. It works only when the table is imported and not linked. Why is it so, and how can i remedy it?
Best Regards
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Can’t make Opera my default browser
by
bmeacham
2 hours, 4 minutes ago -
Do not Fall For This Purdentix Scam (Awaiting moderation)
by
elizabethkaur56
2 hours, 10 minutes ago -
*Some settings are managed by your organization
by
rlowe44
12 hours, 9 minutes ago -
Formatting of “Forward”ed e-mails
by
Scott Mills
14 hours, 23 minutes ago -
SmartSwitch PC Updates will only be supported through the MS Store Going Forward
by
PL1
14 hours, 48 minutes ago -
CISA warns of hackers targeting critical oil infrastructure
by
Nibbled To Death By Ducks
23 hours, 48 minutes ago -
AI slop
by
Susan Bradley
22 hours, 59 minutes ago -
Chrome : Using AI with Enhanced Protection mode
by
Alex5723
1 day, 1 hour ago -
Two blank icons
by
CR2
10 hours, 38 minutes ago -
Documents, Pictures, Desktop on OneDrive in Windows 11
by
ThePhoenix
1 day, 9 hours ago -
End of 10
by
Alex5723
1 day, 12 hours ago -
Single account cannot access printer’s automatic duplex functionality
by
Bruce
10 hours, 34 minutes ago -
test post
by
gtd12345
1 day, 18 hours ago -
Privacy and the Real ID
by
Susan Bradley
1 day, 8 hours ago -
MS-DEFCON 2: Deferring that upgrade
by
Susan Bradley
1 day ago -
Cant log on to oldergeeks.Com
by
WSJonharnew
1 day, 23 hours ago -
Upgrading from Win 10
by
WSjcgc50
10 hours, 44 minutes ago -
USB webcam / microphone missing after KB5050009 update
by
WSlloydkuhnle
14 hours, 17 minutes ago -
TeleMessage, a modified Signal clone used by US government has been hacked
by
Alex5723
2 days, 14 hours ago -
The story of Windows Longhorn
by
Cybertooth
2 days, 2 hours ago -
Red x next to folder on OneDrive iPadOS
by
dmt_3904
2 days, 16 hours ago -
Are manuals extinct?
by
Susan Bradley
2 hours, 15 minutes ago -
Canonical ditching Sudo for Rust Sudo -rs starting with Ubuntu
by
Alex5723
3 days, 1 hour ago -
Network Issue
by
Casey H
2 days, 12 hours ago -
Fedora Linux is now an official WSL distro
by
Alex5723
3 days, 13 hours ago -
May 2025 Office non-Security updates
by
PKCano
3 days, 14 hours ago -
Windows 10 filehistory including onedrive folder
by
Steve Bondy
3 days, 16 hours ago -
pages print on restart (Win 11 23H2)
by
cyraxote
2 days, 17 hours ago -
Windows 11 Insider Preview build 26200.5581 released to DEV
by
joep517
3 days, 18 hours ago -
Windows 11 Insider Preview build 26120.3950 (24H2) released to BETA
by
joep517
3 days, 18 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.