472,328 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Dynamically generated form input fields

I have the following three tables in a ms access database:
VISITS
ID | CLIENT ID | DATE ADDED

MEASUREMENTS
ID | LABEL

RESULTS
ID | VISIT ID | MEASUREMENT ID | VALUE

[VISIT ID] and [MEASUREMENT ID] are foreign keys referencing VISITS and MEASUREMENTS respectively.
I need to create a form where the user can enter values into the results table based on the records stored in the
MEASUREMENTS table. So basically if the MEASUREMENTS table had the following records:

ID | LABEL
1 | Measure1
2 | Measure2
3 | Measure3
The final form should look something like:
---------------------------
Client : [select box]
Date Added : [text box]

Measure1 : [user enters result 1]
Measure2 : [user enters result 2]
Measure3 : [user enters result 3]
---------------------------

I'm not experienced with MS Access and don't really know how to create such a form.
What do you recommend? Thanks in advance.
Sep 16 '07 #1
1 3223
FishVal
2,653 Expert 2GB
Hi, hamstur.
  • create form linked to table [Visits], let us say [frmVisits]
  • create a query
    Expand|Select|Wrap|Line Numbers
    1. SELECT Measurements.[ID], Measurements.Label, Results.[ID], Results.[Visit ID], Results.[MeasurementID], Results.[Value]
    2. FROM Measurements LEFT JOIN (SELECT * FROM Results WHERE Results.[Visit ID]=nz(Forms!frmVisits![Visit ID],0)) AS Results ON Measurements.[ID]=Results.[Measurement ID]
    3. WHERE Not Isnull(Forms!frmVisits![Visit ID]);
    4.  
  • create a form based on the query above, let us say [sbfResults]
  • set it AllowAdditions property to "No", set it DefaultView property to "Datasheet"
  • place [sbfResults] form to [frmVisits] as subform not linking it via Master/Child fields
  • in [frmVisits] module place the following code
    Expand|Select|Wrap|Line Numbers
    1. Private Sub Form_AfterInsert()
    2.     Me.sbfResults.Requery
    3. End Sub
    4.  
  • in [sbfResults] module place the following code
    Expand|Select|Wrap|Line Numbers
    1. Private Sub Form_BeforeUpdate(Cancel As Integer)
    2.     Me.[Visit ID] = Me.Parent.[ID]
    3. End Sub
    4.  
Sep 16 '07 #2

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

Similar topics

1
by: Peter Kirk | last post by:
Hi there I have a form which submits a list of data to a web-application (which then saves to a database). The list consists of four input...
4
by: EmmettPower | last post by:
Hi, I have a form which includes a field 'number'. When 'number' is changed additional fields ('item_0', etc) are generated on the form using...
1
by: Daniel Gormley | last post by:
What I have is a form that is dynamically generated based on which database table its calling. Therefore, the number of category.name.count can be...
4
by: Stone Chen | last post by:
Hello, I have form that uses javascript createElement to add additional input fields to it. However, my validating script will not process new...
5
by: stellstarin | last post by:
I have a html where fields are created and added dynamically on the client side. I use the AppendChild() call to create fields dynamically. On...
1
by: hardieca | last post by:
Hi, I'm building a multi-lingual CMS. The user can add as many languages as he likes. The user will be able to create sections for different...
1
verbatim
by: verbatim | last post by:
with the following page, the dynamically generated fields are not recognized when i try to submit the form, or add more elements. when i hit my...
5
by: phpCodeHead | last post by:
I am needing to determine how to go about validating that a field in my form contains only a positive integer. I know that this is fairly simple if...
7
by: Srikanth Ram | last post by:
Hi, I'm creating a PHP application. In this a dynamic table with the fields in the database is generated in a page. I have placed a checkbox in...
1
by: divyac | last post by:
I am doing an inventory project using PHP in which there is a text box.The customer id should be entered in that text box.If that customer id is...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
1
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

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.