Combo change to Text Field on a Form

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • N. Graves

    Combo change to Text Field on a Form

    Hello;
    I have a table that is equipment. This table has a filed called Owner
    and that Owner filed is Looked up from a table called employee. and
    the query request the serial number of the employee and his/her name.
    I have this field bound to the serial number but it displays the name
    in a data sheet. Works great,

    My problem is I have a form that I want to be used as display and
    informational but not data entry or editing. I would like to display
    the employees name on it but when I change the combo box to a text
    field it shows the employee number.
  • Hans-Joerg Karpenstein

    #2
    Re: Combo change to Text Field on a Form

    Am Thu, 15 Apr 2004 13:06:04 -0400 schrieb N.Graves:
    [color=blue]
    > Hello;
    > I have a table that is equipment. This table has a filed called Owner
    > and that Owner filed is Looked up from a table called employee. and
    > the query request the serial number of the employee and his/her name.
    > I have this field bound to the serial number but it displays the name
    > in a data sheet. Works great,
    >
    > My problem is I have a form that I want to be used as display and
    > informational but not data entry or editing. I would like to display
    > the employees name on it but when I change the combo box to a text
    > field it shows the employee number.[/color]

    Hello,

    try

    =Dlookup("perso ntable","namefi eld","id=" & combobox

    as recordsource property of the field


    HTH
    Karpi
    <fluctuat nec mergitur>

    Comment

    • N. Graves

      #3
      Re: Combo change to Text Field on a Form

      Thank you for suggestion!

      I tried to use your suggestion and I don't think my first post was
      clear enough.

      Bare with me and I'll try again.

      I have a form I want to be a view only form. This equipment table has
      several fields that the values are lookups from other tables. An
      example is the Owner field is a lookup field based on the Employee
      table it is bound to the employee number but displays the name. When
      I created the form for Equipment table the field "Owner" is displayed
      as a Combo box and I want to convert it to a text field. When I do
      this it will only display the Employee ID and not the name.

      Please let me know if you have any other suggestions.


      On Thu, 15 Apr 2004 22:22:22 +0200, Hans-Joerg Karpenstein
      <hjkarpenstein@ web.de> wrote:
      [color=blue]
      >Am Thu, 15 Apr 2004 13:06:04 -0400 schrieb N.Graves:
      >[color=green]
      >> Hello;
      >> I have a table that is equipment. This table has a filed called Owner
      >> and that Owner filed is Looked up from a table called employee. and
      >> the query request the serial number of the employee and his/her name.
      >> I have this field bound to the serial number but it displays the name
      >> in a data sheet. Works great,
      >>
      >> My problem is I have a form that I want to be used as display and
      >> informational but not data entry or editing. I would like to display
      >> the employees name on it but when I change the combo box to a text
      >> field it shows the employee number.[/color]
      >
      >Hello,
      >
      >try
      >
      >=Dlookup("pers ontable","namef ield","id=" & combobox
      >
      >as recordsource property of the field
      >
      >
      >HTH
      >Karpi
      ><fluctuat nec mergitur>[/color]

      Comment

      • Noam Nelke

        #4
        Re: Combo change to Text Field on a Form

        Hi!

        I think Karpi's idea WAS good for you. What you need to do is this:

        Create a Text Box. As it's Control Source use the DLookup Function.
        This is how you use it:

        =DLookup("<Name of field you want displayed (EmployeeName)> ", "<Name
        of the table where it's kept (Employees)>", "<Name of the key field
        (EmployeeNumber )> = " & <The field that contains the Employee number
        for which you want to display the name (Owner)>)

        Without the explainations it would look like this:

        =Dlookup("Emplo yeeName", "Employees" , "EmlpoyeeNu mber = " & [Owner])

        Now you only need to change the names to the exact names you used (if
        they're different).

        If you don't want the user to be able to change the data just change
        the field properties "Enabled" to "No" and "Locked" to "Yes" (they're
        on the "Data" tab of the Properties, when the textbox is selected)

        Hope this helps...

        Noam Nelke, Israel.

        Comment

        • N. Graves

          #5
          Re: Combo change to Text Field on a Form

          Thank you very much for your insight.

          I think the part that of Karpi response was the statement "as record
          source property of the field".

          That worked very well and the second part of your suggestion was the
          one that I used for my forms

          Thanks

          On 16 Apr 2004 17:24:18 -0700, noamnelke@hotma il.com (Noam Nelke)
          wrote:
          [color=blue]
          >Hi!
          >
          >I think Karpi's idea WAS good for you. What you need to do is this:
          >
          >Create a Text Box. As it's Control Source use the DLookup Function.
          >This is how you use it:
          >
          >=DLookup("<Nam e of field you want displayed (EmployeeName)> ", "<Name
          >of the table where it's kept (Employees)>", "<Name of the key field
          >(EmployeeNumbe r)> = " & <The field that contains the Employee number
          >for which you want to display the name (Owner)>)
          >
          >Without the explainations it would look like this:
          >
          >=Dlookup("Empl oyeeName", "Employees" , "EmlpoyeeNu mber = " & [Owner])
          >
          >Now you only need to change the names to the exact names you used (if
          >they're different).
          >
          >If you don't want the user to be able to change the data just change
          >the field properties "Enabled" to "No" and "Locked" to "Yes" (they're
          >on the "Data" tab of the Properties, when the textbox is selected)
          >
          >Hope this helps...
          >
          >Noam Nelke, Israel.[/color]

          Comment

          Working...