Subform Data

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

    Subform Data

    I have a main form with customer information and a Job_No on it. I also have
    a button to call a subform. How do I pupulate the Job_No into the subform
    when it loads up. Thanks


  • PC Datasheet

    #2
    Re: Subform Data

    Add this line of code to your code that opens the subfrom after the
    DoCmd.OpenForm:

    Me!NameOfSubfor mControl![Job_No] = Me![Job_No]


    --
    PC Datasheet
    Your Resource For Help With Access, Excel And Word Applications
    resource@pcdata sheet.com



    "home" <rech@telkomsa. net> wrote in message
    news:bpbahu$185 $1@ctb-nnrp2.saix.net. ..[color=blue]
    > I have a main form with customer information and a Job_No on it. I also have
    > a button to call a subform. How do I pupulate the Job_No into the subform
    > when it loads up. Thanks
    >
    >[/color]


    Comment

    • home

      #3
      Re: Subform Data

      I have tried what you suggested but still no joy, this is what my cade looks

      like.

      Private Sub cmb_NewJob_Clic k()

      On Error GoTo Err_cmb_NewJob_ Click

      Dim stDocName As String

      Dim stLinkCriteria As String

      stDocName = "Job subform"

      stLinkCriteria = "[Job_No]=" & "'" & Me![Job_No] & "'"

      DoCmd.OpenForm stDocName, , , stLinkCriteria

      '

      Exit_cmb_NewJob _Click:

      Exit Sub

      Err_cmb_NewJob_ Click:

      MsgBox Err.Description

      Resume Exit_cmb_NewJob _Click

      End Sub



      my Job_No on subform comes up blank every time!




      "PC Datasheet" <spam@nospam.sp am> wrote in message
      news:Sabub.6813 $Wy4.4562@newsr ead2.news.atl.e arthlink.net...[color=blue]
      > Add this line of code to your code that opens the subfrom after the
      > DoCmd.OpenForm:
      >
      > Me!NameOfSubfor mControl![Job_No] = Me![Job_No]
      >
      >
      > --
      > PC Datasheet
      > Your Resource For Help With Access, Excel And Word Applications
      > resource@pcdata sheet.com
      > www.pcdatasheet.com
      >
      >
      > "home" <rech@telkomsa. net> wrote in message
      > news:bpbahu$185 $1@ctb-nnrp2.saix.net. ..[color=green]
      > > I have a main form with customer information and a Job_No on it. I also[/color][/color]
      have[color=blue][color=green]
      > > a button to call a subform. How do I pupulate the Job_No into the[/color][/color]
      subform[color=blue][color=green]
      > > when it loads up. Thanks
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Ben Eaton

        #4
        Re: Subform Data

        Instead of just setting the value of the Job No, set the default value of
        the control that holds it...

        "home" <rech@telkomsa. net> wrote in message
        news:bpdh5d$1vk $1@ctb-nnrp2.saix.net. ..[color=blue]
        > I have tried what you suggested but still no joy, this is what my cade[/color]
        looks[color=blue]
        >
        > like.
        >
        > Private Sub cmb_NewJob_Clic k()
        >
        > On Error GoTo Err_cmb_NewJob_ Click
        >
        > Dim stDocName As String
        >
        > Dim stLinkCriteria As String
        >
        > stDocName = "Job subform"
        >
        > stLinkCriteria = "[Job_No]=" & "'" & Me![Job_No] & "'"
        >
        > DoCmd.OpenForm stDocName, , , stLinkCriteria
        >
        > '
        >
        > Exit_cmb_NewJob _Click:
        >
        > Exit Sub
        >
        > Err_cmb_NewJob_ Click:
        >
        > MsgBox Err.Description
        >
        > Resume Exit_cmb_NewJob _Click
        >
        > End Sub
        >
        >
        >
        > my Job_No on subform comes up blank every time!
        >
        >
        >
        >
        > "PC Datasheet" <spam@nospam.sp am> wrote in message
        > news:Sabub.6813 $Wy4.4562@newsr ead2.news.atl.e arthlink.net...[color=green]
        > > Add this line of code to your code that opens the subfrom after the
        > > DoCmd.OpenForm:
        > >
        > > Me!NameOfSubfor mControl![Job_No] = Me![Job_No]
        > >
        > >
        > > --
        > > PC Datasheet
        > > Your Resource For Help With Access, Excel And Word Applications
        > > resource@pcdata sheet.com
        > > www.pcdatasheet.com
        > >
        > >
        > > "home" <rech@telkomsa. net> wrote in message
        > > news:bpbahu$185 $1@ctb-nnrp2.saix.net. ..[color=darkred]
        > > > I have a main form with customer information and a Job_No on it. I[/color][/color][/color]
        also[color=blue]
        > have[color=green][color=darkred]
        > > > a button to call a subform. How do I pupulate the Job_No into the[/color][/color]
        > subform[color=green][color=darkred]
        > > > when it loads up. Thanks
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        Working...