Form problem

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

    Form problem

    I am creating a relational database for inspection and re-ordering
    purposes. I have a form called 'Site' which contains various fields,
    one in particular is called SiteNumber. I would like it so there is a
    button next to the SiteNumber field and when it is clicked, the data
    in that field is put into the SiteNumber field in the relating form,
    'Inspection'.

    It is probably quite a simple piece of code to achieve this, however I
    need some assistance.

    Many Thanks.
  • Pavel Romashkin

    #2
    Re: Form problem

    Put this in the Click event of the button:

    Forms!Inspectio n!SiteNumber = Me.SiteNumber

    Me.SiteNumber is the name of the text control on the Site form. If you
    named it txtSiteNumber as you should have, then change to Me.txtSiteNumbe r.
    Good luck,
    Pavel

    James wrote:[color=blue]
    >
    > I am creating a relational database for inspection and re-ordering
    > purposes. I have a form called 'Site' which contains various fields,
    > one in particular is called SiteNumber. I would like it so there is a
    > button next to the SiteNumber field and when it is clicked, the data
    > in that field is put into the SiteNumber field in the relating form,
    > 'Inspection'.
    >
    > It is probably quite a simple piece of code to achieve this, however I
    > need some assistance.
    >
    > Many Thanks.[/color]

    Comment

    • Mike Storr

      #3
      Re: Form problem

      If 'Inspection' is a subform...

      Me!subformcontr ol.Form!SiteNnu mber = Me!SiteNumber

      If they are two individual forms...

      Forms!Inspectio n!SiteNumber = Me!SiteNumber

      Mike Storr



      "James" <jammie_runnies @hotmail.com> wrote in message
      news:7a6254bf.0 402170856.27ced 94@posting.goog le.com...[color=blue]
      > I am creating a relational database for inspection and re-ordering
      > purposes. I have a form called 'Site' which contains various fields,
      > one in particular is called SiteNumber. I would like it so there is a
      > button next to the SiteNumber field and when it is clicked, the data
      > in that field is put into the SiteNumber field in the relating form,
      > 'Inspection'.
      >
      > It is probably quite a simple piece of code to achieve this, however I
      > need some assistance.
      >
      > Many Thanks.[/color]


      Comment

      • James

        #4
        Re: Form problem

        Thanks for that it worked but there is still one slight problem.

        The form, frmInspection, is where the data in SiteNumber on frmSite
        and InspectorNumber on frmInspector will be sent. My system is menu
        driven. So, if an inspector clicks on 'Inspector Index', frmInspector
        will open with fields shown about the inspector. I have a button that
        sends the InspectorNumber data to the inspection form, but as I have
        opted for a wizard style approach I want this to happen, but at the
        same time for the frmInspector to close and the frmSite to open. I
        tried this..

        Forms!frmInspec tion!InspectorN umber = Me!InspectorNum ber
        DoCmd.OpenForm "frmSite"
        DoCmd.Close acForm, "frmInspect or"

        Then when the site user gets to the site form the same process will
        happen but SiteNumber data will be sent to the inspection form.

        At the moment the whole thing works if all the forms are open and when
        you click on the buttons the process should work. However nothing
        happens if the forms aren't already open. So something is wrong
        regarding the opening and closing of forms.

        Hope this makes some sense and some help would be much appreciated.
        Thanks,
        James

        "Mike Storr" <nobody@somewhe re.con> wrote in message news:<5ttYb.569 5$Cd6.389416@ne ws20.bellglobal .com>...[color=blue]
        > If 'Inspection' is a subform...
        >
        > Me!subformcontr ol.Form!SiteNnu mber = Me!SiteNumber
        >
        > If they are two individual forms...
        >
        > Forms!Inspectio n!SiteNumber = Me!SiteNumber
        >
        > Mike Storr
        > www.veraccess.com
        >
        >
        > "James" <jammie_runnies @hotmail.com> wrote in message
        > news:7a6254bf.0 402170856.27ced 94@posting.goog le.com...[color=green]
        > > I am creating a relational database for inspection and re-ordering
        > > purposes. I have a form called 'Site' which contains various fields,
        > > one in particular is called SiteNumber. I would like it so there is a
        > > button next to the SiteNumber field and when it is clicked, the data
        > > in that field is put into the SiteNumber field in the relating form,
        > > 'Inspection'.
        > >
        > > It is probably quite a simple piece of code to achieve this, however I
        > > need some assistance.
        > >
        > > Many Thanks.[/color][/color]

        Comment

        Working...