Results 1 to 2 of 2
  1. #1
    jobrien4 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    20

    Converting MM to Inches (and vice versa) in Query

    I have begun desiging a database for my company that stores information about parts we produce for our customers. I am relatively new to Access.

    Sometimes customers parts have dimensions given in inches, while other times they are given in millimeters. I would rather have a query do the conversion to inches than the person doing it prior to inputting data.

    Here is how I was planning on handling this:

    I have a table with the following fields:
    Part Number
    Thickness(In)
    Width(In)
    Length(In)
    Thickness(MM)
    Width(MM)
    Length(MM)



    When the query is ran, I use an Iif to see whether MM was inputted and if the user inputted in MM, it creates a new field that converts to inches.

    However, here is where I need help. I would like a validation rule to only allow Thickness(In) or Thickness(MM) to be inputted. For instance, if the user inputs a value for Thickness(In), I would like Access to prevent the user from inputting Thickness(MM) (unless Thickness(In) is null or =0).

    How can I accomplish this?

  2. #2
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    You can use the After Update or LostFocus Event of Thickness(In) or Thickness(MM) and if there is a value > 0 entered in one - then you can Set the Enabled Property of the other one to False.

    Eg:
    Right-Click ThicknessIN
    Click Properties
    Click the Event Tab
    Click After Update
    Click Code Builder
    Type in something like this:

    Code:
     
    If Me.ThicknessIN > 0 Then
        Me.ThicknessMM.Enabled = False
    End If
    I have not tested the above code so you might have to tweak it.
    I've put it there to give you somethign to start with.

    Let me know if you need further clarification.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Converting mde to mdb
    By Jdejesus in forum Access
    Replies: 2
    Last Post: 04-08-2011, 11:52 AM
  2. Replies: 6
    Last Post: 01-31-2011, 03:31 PM
  3. Send in Email Body vice Attachment
    By cassidym in forum Programming
    Replies: 2
    Last Post: 10-20-2010, 06:21 AM
  4. Converting an Access pivot query to SQL 2005
    By csharpnewbie in forum Queries
    Replies: 1
    Last Post: 10-05-2010, 04:22 AM
  5. Replies: 0
    Last Post: 12-23-2008, 01:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums