• View Record Source in Form

    • This topic has 10 replies, 2 voices, and was last updated 24 years ago.
    Author
    Topic
    #356224

    I have a form for tracking inventory. I have macro buttons with part numbers on them that change the recordsource of one form to view all parts rather that create many forms.
    What I want to do is, when the form comes up and there are no parts in stock, I have a control that says “NO STOCK”.
    But the other controls are blank. I would like to be able to show the record source, which is a query named with the actual part number. So if I could show the record source, it would show the part number that we are out of in the form. I dont know if this can be done, but any help would be greatly appreciated. (Access 97) SR1
    Thanks
    Cary

    Viewing 0 reply threads
    Author
    Replies
    • #526788

      is the part number in the criteria field of the query if so why not set a control for this field

      • #526789

        The part number is in the Criteria field in the query in quotes. But if there are no parts in stock, the query comes up empty so the part number doesnt show in the form.
        I dont understand how you would put a control in the form that would show that criteria in the query.

        • #526791

          is the part number still in the field even though there is no stock
          also how do you start the query from a button a list or combo box or what

          • #526794

            I have a query for eacn part number so it doesnt have to be typed in a parameter box. A command button on the menu form
            runs a macro and changes the form record source to the correct query. So when the form opens and there is no record in the query, all controls come up blank in the form.
            I want the part number to show even though there are no records.
            Thanks for your help
            Cary

            • #526815

              is there a command button for each part number
              if not how do you tell the macro what part number you want

            • #526823

              In this data base there are six part numbers. Each has four different lenghts and two colors. I have a query set up for each part number with each length. So there are 24 queries. I used [type color] parameter in each query to avoid making an additional 12 queries. You may ask why I didnt just use a [type part number] paremeter too. I wanted to make it easier one the user to just click one button and type in one color number instead of typing in (part number)(length) and (color). When the command button is clicked, it opens the form and it runs the set value command and uses the right query and the query only asks the user for the color number. But if there is no stock the form comes up and a control says “NO STOCK”, but since there is no record, it shows no part number so the user has to remember the correct (part number);(length) button she clicked. That’s why I would like it to show the part number.
              Thanks again for trying to help
              Cary

            • #526825

              ok i taking it that you have six different buttons for the part numbers
              if this is correct
              place an unbound textbox on the form
              then on the onclick of the button put the part number in the text box
              like this
              text1 = “the part number”
              the part number will stay there until you remove it or replace it with another number
              also if you wanted you could make a list box for color and the user wouldn’t have to type that
              let me know if any of this works for you

            • #526826

              i was just re reading your form setup
              if you wanted you could place three listboxes or combo boxes in the form one for part number one for length and the other for color that way one query would work for all part numbers and and unbound textbox for each list or combo box would let you know all the information when the “no stock” came up
              just a thought

            • #526843

              In the on click event of the command button that runs the macro it already has the name of the macro there. I tried to put it in other events but it just says unable to find “part number”. Even when put in quotes, it still thinks it is looking for a macro. I dont see how this would work anyway since the form is not even open at this point so the unbound text box in not even in existence yet. I guess this just can not be done. Thanks for trying to help though.
              Cary

            • #526845

              yes it can be done
              remove the macro from the on click event
              now click on the three dot button at the left on the on click event then choose code builder
              now enter the name of the unbound textbox like this
              text1 = “part number”
              hit enter and on the next line run your macro
              docmd.RunMacro “macro name”
              this will fill the text box with the part number and then run your macro
              don’t give up this is easier than you think
              it’s just a different way than you are use to
              if you want send me a zipped db with this form in it and i will show you what i mean
              if you want send to jwcurry@cafes.net

    Viewing 0 reply threads
    Reply To: View Record Source in Form

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: