Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 137575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:07:40+00:00 2026-05-11T07:07:40+00:00

I have a database for a carpet company. I have a form which enables

  • 0

I have a database for a carpet company. I have a form which enables the user to make a quote, including choosing the customer, etc. There is a also subform dealing with the products and extras, with quantities and unit prices. To state whether the user requires fitting there is a checkbox. When ticked I would like fitting to be added in the subform as one of the products. Products are normally manually chosen using a dropdown.

Important properties are:
Form name: Orders
Subform name: Order Details Subform
Checkbox name: Fitting
Field name for products: Product ID
Subform linked to table: Order Details
Form linked to table: Orders

I’m assuming VBA is needed, or the macro builder.

Anyway thanks in advance!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T07:07:40+00:00Added an answer on May 11, 2026 at 7:07 am

    On the check box control, you are going to add an [Event Procedure] on the After Update event for the checkbox (see the properties window). This will stub out the VBA code, click on the ellipsis (‘…’) to get to the VBA code.

    You can use Remou’s code (after a fashion) to insert the new Product:

    If Me.Fitting Then     strSQL='INSERT INTO [Order Details] (ProductID,OtherTextField) ' & _         'Values (' & _         Me.ProductID & ','' & Me.OtherTextField & '')'     CurrentDB.Execute strSQL, dbFailOnError      Me.[Subform control name here].Form.Requery End If '[code not tested] 

    However, you probably also want to check that the Product doesn’t already exist in for the Order (does your business rules allow for multiple fittings to be scheduled), and you might also want to allow the Fitting product to be removed when it is unchecked – you could do that with an else condition on the if before the ‘end if’:

    if 'blah      'blah blah else     strSQL='Delete [Order Details] ' & _         'where ProductID = ' & Me.ProductID & ' ' & _             'and OtherTextField = 'fitting' '      CurrentDB.Execute strSQL, dbFailOnError      Me.[Subform control name here].Form.Requery end if '[code not tested] 

    You will also have to hack your Products sub form so that if you delete the Fitting product from it, you update the check box (or so that you can’t delete Fittings that way).

    Then again maybe you don’t want to use a check box, and just have the fitting as being another drop down option, as the other products are. You could always make sure it’s auto-populated into [Order Details] whenever a new Order is created so it can’t be forgotten. This would be more consistent with the rest of the product selection user interface.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have database application, I want to allow the user to restore the deleted
I have database table Inbox(id,accountid,emailfrom,emailsubject,emailbody, recieveddate,attachment, read(bool) i have added it to the form
I have database in which data is imported from the other table. if data
I have database table with the follwoing fields: id, loan_no, installment, status which has
i have database from which i get data to my C# app using SQL
i have database table with few text fields which i use to filter data
Which one is faster to have database key as String or as Long? If
I have database heavy operations happening, which adds around 10,000 records to my Database.
I have database entry for password in md5 format, but when user uses the
I have database called Auth, there are fields: id, auth, is_active, created_at, updated_at i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.