473,321 Members | 1,748 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,321 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 3307
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.