473,382 Members | 1,752 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.

Button linking a continuous sub-form to a form (both built around several tables)

41
Dear All,

I’ve been using this forum since three weeks now and I always had the answer to my questions. So this encourages me to use it again but I hope I am not annoying anybody.

I am trying to develop databases for my company but I have little knowledge of Access, which means that I am learning while building them. I don’t post here my questions before having turned around the problem and done some research on my side. So I greatly appreciate your advices, which have so far helped me a lot. I hope you don’t bother helping me further.

So here is my question:

My tables are as follows:
[Company] – Primary Key: [Account Number]
[Currency] – Primary Key: [Currency ID]
[Group] – Primary Key: [Group ID]
[Owner] – Primary Key: [Owner ID]
[Project Lines – Existing] – Primary Key: [ProjectID]
[Project Lines – Oustanding] – Primary Key: [ProjectID]
[Project Lines – Proposed] – Primary Key: [ProjectID]
[Projects] – Primary Key: [ProjectID]
[RM] – Primary Key: [RMID]

The relationships of the tables are as follows:
[Group] One-to-many [Company] through [Group ID]
[RM] One-to-many [Company] through [RMID]
[Company] One-to-many [Projects] through [Account Number]
[Owner] One-to-many [Projects] through [Owner ID]
[Currency] One-to-many [Projects] through [CurrencyID]
[Project Lines – Existing] One-to-one [Projects] through [ProjectID]
[Project Lines – Oustanding] One-to-one [Projects] through [ProjectID]
[Project Lines – Proposed] One-to-one [Projects] through [ProjectID]

I have a main form called ‘Company Projects List’, which regroup data from tables [Company], [Group], [Owner].

I have then a continuous sub-form to this main form called ‘Projects Subform’, which regroups data from tables [Projects], [Currency], [Owner]

I have finally a form called ‘Project Details’, which regroups data from all the tables cited above ([Company], [Currency], [Group], [Owner], [Project Lines – Existing], [Project Lines – Oustanding], [Project Lines – Proposed], [Projects], [RM])

Here is what I am trying to do:
I want to have a button on ‘Projects Subform’. When I click on this button, the ‘Project Details’ form will pop up and give me all the details pertaining to the related project (stored in the various tables cited above).

But this seems more complicated than what I have thought primarily…

I hope I have been clear enough on my request. Otherwise, please let me know so I can give more precisions. Also, if you feel that it would be easier to look directly into the code, I can post my database in the thread.

Thank you very much for your feedback and your help.

Best regards,

G.
Jan 21 '07 #1
4 1679
MMcCarthy
14,534 Expert Mod 8TB
My tables are as follows:
[Company] – Primary Key: [Account Number]
[Currency] – Primary Key: [Currency ID]
[Group] – Primary Key: [Group ID]
[Owner] – Primary Key: [Owner ID]
[Project Lines – Existing] – Primary Key: [ProjectID]
[Project Lines – Oustanding] – Primary Key: [ProjectID]
[Project Lines – Proposed] – Primary Key: [ProjectID]
[Projects] – Primary Key: [ProjectID]
[RM] – Primary Key: [RMID]

The relationships of the tables are as follows:
[Group] One-to-many [Company] through [Group ID]
[RM] One-to-many [Company] through [RMID]
[Company] One-to-many [Projects] through [Account Number]
[Owner] One-to-many [Projects] through [Owner ID]
[Currency] One-to-many [Projects] through [CurrencyID]
[Project Lines – Existing] One-to-one [Projects] through [ProjectID]
[Project Lines – Oustanding] One-to-one [Projects] through [ProjectID]
[Project Lines – Proposed] One-to-one [Projects] through [ProjectID]

I have a main form called ‘Company Projects List’, which regroup data from tables [Company], [Group], [Owner].

I have then a continuous sub-form to this main form called ‘Projects Subform’, which regroups data from tables [Projects], [Currency], [Owner]

I have finally a form called ‘Project Details’, which regroups data from all the tables cited above ([Company], [Currency], [Group], [Owner], [Project Lines – Existing], [Project Lines – Oustanding], [Project Lines – Proposed], [Projects], [RM])

Here is what I am trying to do:
I want to have a button on ‘Projects Subform’. When I click on this button, the ‘Project Details’ form will pop up and give me all the details pertaining to the related project (stored in the various tables cited above).
Gari

If you put the code behind the button click

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm "Project Details", , ,"[ProjectID]=" & Forms![Company Projects List]![Projects Subform].Form![ProjectID]
  2.  
Mary
Jan 21 '07 #2
Gari
41
Dear Mary,

Thank you very much for your reply. I am a bit confused but I have to tell that when testing your code and answering to you, I turned around the database once again and I figured out that actually the problem did not come from the code but from the 'Project Details' form where one text box was not properly bound (the one containing the ProjectID). I corrected this and used the button access wizard and it worked perfectly.

The code I got is as follows (fyi only)

Expand|Select|Wrap|Line Numbers
  1. Private Sub Go_To_Details_Click()
  2.  
  3.     Dim stDocName As String
  4.     Dim stLinkCriteria As String
  5.  
  6.     stDocName = "Project Details"
  7.  
  8.     stLinkCriteria = "[ProjectID]=" & "'" & Me![ProjectID] & "'"
  9.     DoCmd.OpenForm stDocName, , , stLinkCriteria
  10.  
  11. End Sub
(Btw, what the 'Me!' refers to in the code ?)

But anyway thank you very much for your time.

Best regards,

G.
Jan 22 '07 #3
MMcCarthy
14,534 Expert Mod 8TB
Dear Mary,

Thank you very much for your reply. I am a bit confused but I have to tell that when testing your code and answering to you, I turned around the database once again and I figured out that actually the problem did not come from the code but from the 'Project Details' form where one text box was not properly bound (the one containing the ProjectID). I corrected this and used the button access wizard and it worked perfectly.

The code I got is as follows (fyi only)

Expand|Select|Wrap|Line Numbers
  1. Private Sub Go_To_Details_Click()
  2.  
  3.     Dim stDocName As String
  4.     Dim stLinkCriteria As String
  5.  
  6.     stDocName = "Project Details"
  7.  
  8.     stLinkCriteria = "[ProjectID]=" & "'" & Me![ProjectID] & "'"
  9.     DoCmd.OpenForm stDocName, , , stLinkCriteria
  10.  
  11. End Sub
(Btw, what the 'Me!' refers to in the code ?)

But anyway thank you very much for your time.

Best regards,

G.
The Me! (or Me.) is just the codes way of referring to the Current form or subform that the event (in this case the button click) is taking place on.

Mary
Jan 22 '07 #4
Gari
41
Thank you Mary for your answer. I'll start using it from now.

Best regards,

G.
Jan 22 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: wendy | last post by:
I created com add-in for word2003, excel2003 and powerpoint2003, basically, i added 4 button in toobar and on_click, i apply some bussiness logic. all works in excel2003 and powerpoint 2003, but in...
0
by: Dailan | last post by:
Hi, I create a tree view. Each node has link button associate with it, which includes add, edit, delete buttons. The way I did is for users who have very low capablity of using computer. Now I...
3
by: Chris | last post by:
Hi Folks, well I have this "small" problem with the footertemplate in a datalist. I added a button and a textbox to update the db with the given String of the Textbox. I already searched for...
2
by: alan | last post by:
Hi all, I need to pass a variable to the client-side vbscript and when the button is pressed invoke the script (SomeSub()). The problem is, that the "blablabla" appears only after second...
6
by: jcrouse | last post by:
I am having problems with a Label_Paint event causing a continuous loop. Here is an explanation of the code. I right click on a label and a context menu pops up. I then select a menu...
3
by: Chris Dunaway | last post by:
I have derived a class from the System.Windows.Forms.Button class in order to draw the button differently. Among other things, I paint the background of the button in the OnPaing override. ...
12
by: SJ | last post by:
Hope someone can help me out there I'm struggling with a particular problem... I have a form with many tab pages. On one tab page I've got a button which when clicked with a mouse adds items...
9
by: martin1 | last post by:
Hi, All, how to flash button with 2 color( eg. red and white)? then when user click button, the button stop flash and stay red color? Thanks
7
by: =?Utf-8?B?bWFydGluMQ==?= | last post by:
Hi, All, I create button in the code ( Dim Button as new Button), not using button web component (means not drap button and drop it ont he webform), after that I try to use button_click event,...
0
bilal12pk
by: bilal12pk | last post by:
Hi everyone i am looking for (Button Linkings) i want to make a link with button if it will clicked then control panel will open. Also looking for a webpage linking on the buttons and texts so please...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.