473,378 Members | 1,405 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,378 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 3308
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 fields per row. Eg....
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 'onchange'. I want to validate 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 different. So I have this form generated and...
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 input fields because it can only find the named...
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 submit i try to get the value for all the...
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 content (General, News Releases, etc...) in the db...
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 submit button, the address bar has only x1 - x5 in...
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 the form contains only one element to be...
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 each row of the table to approve/disapprove...
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 valid,another text box should be generated in which...
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
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
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: 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.