473,387 Members | 1,606 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,387 software developers and data experts.

Relating forms (newbie)

Using Access 2000, how does a record chosen on one form get transferred to another form? A user choses a record in form 1, and presses a button which opens form 2. I want to work with that record in form 2 but with data from a 2nd, related table. The tables are all related with one to many relationships.

Is there a sql join statement that needs to go behind an event procedure or something?

Thanks for any ideas.
Oct 27 '06 #1
3 1361
MMcCarthy
14,534 Expert Mod 8TB
Using Access 2000, how does a record chosen on one form get transferred to another form? A user choses a record in form 1, and presses a button which opens form 2. I want to work with that record in form 2 but with data from a 2nd, related table. The tables are all related with one to many relationships.

Is there a sql join statement that needs to go behind an event procedure or something?

Thanks for any ideas.
Set the recordsouce of the second form to return ALL relevant records

Then when opening the form using the on click event change the code to

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub CommandXX_OnClick()
  3. Dim stDocname As String
  4. Dim stLinkCriteria As String
  5.  
  6.   stDocName = "Your second form"
  7.   stLinkCriteria = "[ID Field on Form2]=" & Me.[ID Field on Form1]
  8.  
  9.   DoCmd.OpenForm stDocName, , , stLinkCriteria
  10.  
  11. End Sub
  12.  
  13.  
Oct 28 '06 #2
Thanks very much. In debug mode I saw that the ID field did get passed, but I kept getting an 'enter parameter' box, and couldn't figure out where or what the expression was that it was looking for (I'm assuming I had a faulty query behind the record source, but I'm really not sure).

I got around that by using this behind the OnClick event: DoCmd.OpenForm "myForm", acNormal, , "UserID = '" & UserID & "'", , , UserID

10 additional text boxes get populated behind the myForm OnCurrent event: txtVisit2.Value = DateAdd("m", 6, Me.OrigDate)

How can I update the 'Visit' table with the new values in the 10 txtVisit boxes. I tried adding the table to the control source and binding the text boxes, but that didn't work, neither did binding behind a different event (LostFocus specifically).

Thanks for any guidance and your patience with a newbie.
Oct 30 '06 #3
MMcCarthy
14,534 Expert Mod 8TB

10 additional text boxes get populated behind the myForm OnCurrent event: txtVisit2.Value = DateAdd("m", 6, Me.OrigDate)

How can I update the 'Visit' table with the new values in the 10 txtVisit boxes. I tried adding the table to the control source and binding the text boxes, but that didn't work, neither did binding behind a different event (LostFocus specifically).
Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim strSQL As String
  3.  
  4. strSQL = "UPDATE Visit SET Visit.FieldName=#" & txtVisit2 & "# WHERE Visit.OtherFieldName=<Something>;"
  5. DoCmd.RunSQL strSQL
  6.  
  7.  
Oct 30 '06 #4

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

Similar topics

2
by: Henro V | last post by:
Can I integrate 3 existing forms (all based on the same query) integrate in one form by using Tab's? Thanx for thinking, Henro
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
6
by: AMeador | last post by:
I have a form where a user will check boxes next to items that have been completed. They will click a button on the form to mark the items as completed. When they do this, I will have the 'parent'...
3
by: qwerty | last post by:
I´m new to ASP.Net. My workmate has some experience with it. He claimed that in ASP.Net working with frames is much simpler than it was ASP. I asked explanation but he couldn't give me such. (a...
2
by: Mr Newbie | last post by:
I am writing an application in which I have configured Forms Authentication. However, it never seems to time out. I thought the default was twenty minutes. I am wondering if the Persisatnt...
2
by: Pink | last post by:
Hi I am a Newbie to .Net can anyone let me know the diffrence between Windows.Forms and Winforms they are different version of totally different and are some methods different too Thanks
2
by: Eric A. Johnson | last post by:
Hi All, I'm sure this is a newbie problem... but after all, I am a .NET newbie. I'm trying to use MessageBox.Show, according to my book. It tells me to use "Imports System.Windows.Forms". I...
7
by: AdeelAlvi | last post by:
iam working on a project called service desk that automates the departmental services online .one major component i have to create is that to convert paper based forms into dynamic webforms . i...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
4
by: bob | last post by:
Hi, Newbie question. I have a logon Web Form which, once the server has validated the logon, I want to open up a main form. i.e. In a windows app I would write something like if(logon) {...
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: 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
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.