3 forms

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Zabooster
    New Member
    • Dec 2007
    • 8

    3 forms

    I have a project to submit in a few hours' time. In order to explain what I need clearly, I will provide a very simple example. Suppose I have an application consisting of 3 forms-
    The first has a textbox(txtName ) and a button leading to the second form.
    The second has another textbox(txtFami lyName) and a button both leading to the third form and sending the info to a row in MS Access.
    The third only has a button coming back to form1 so that a new row can now be added to the Access file.My Q is:
    1) In which form(s) do I need to establish the connection between my application and the MS Access file?
    2)What is the coding for the buttons in form 2 and 3?

    Your input is greatly appreciated...
  • Zabooster
    New Member
    • Dec 2007
    • 8

    #2
    Oh..n just for clarification, by the info, I meant the text in txtName and that in txtFamilyName!!

    Comment

    • kenobewan
      Recognized Expert Specialist
      • Dec 2006
      • 4871

      #3
      Homework Assignment

      The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve. This question will now be closed and you will have to post a new question when you're ready.

      MODERATOR

      Comment

      • Zabooster
        New Member
        • Dec 2007
        • 8

        #4
        3 forms and an Access file

        I have a project to submit in a few hours' time. In order to explain what I need clearly, I will provide a very simple example. Suppose I have an application consisting of 3 forms-
        The first has a textbox(txtName ) and a button leading to the second form.
        The second has another textbox(txtFami lyName) and a button both leading to the third form and sending the info to a row in MS Access.
        The third only has a button coming back to form1 so that a new row can now be added to the Access file.

        My own project, ofcourse, is much more complicated than this, but I am hoping this would keep things simple and clear...

        Let's assume that I've established a connection between my application and the access file in all three forms... which is exactly what I have done in my own 7 form application (lol!). then in the loading event of form 1 I have typed the following code:

        Dim pintrecords As Integer
        Dim bndTemp As Binding

        pintrecords = odbdaApplicants .Fill(DsApplica nts1)

        bndTemp = New Binding("text", DsApplicants1, "tblApplicants. fldName")
        txtName.DataBin dings.Add(bndTe mp)

        txtName.text=""

        bndTemp = New Binding("text", DsApplicants1, "tblApplicants. fldname")
        txtName.DataBin dings.Add(bndTe mp)

        The reason why I cleared txtName.text was that it was showing info already in the access file and I wanted to enter info that would now go into a new record.

        In the loading event of form 2, I have entered the same coding as above except that I've replaced txtName with txtFamilyName and fldName with fldFamilyName

        In the coding for the button in form 2 I have entered the following:
        Dim pdsInsertedRows As DataSet

        Me.BindingConte xt(DsApplicants 1, "tblApplicants" ).EndCurrentEdi t()

        pdsInsertedRows = DsApplicants1.G etChanges(DataR owState.Added)
        If Not pdsInsertedRows Is Nothing Then
        odbdaApplicants .Update(pdsInse rtedRows)
        End If
        DsApplicants1.A cceptChanges()

        Dim frmNewApplicati on As New Form3
        Me.Hide()
        frmNewApplicati on.Show()

        In coding for the button in form3 I have entered the following:

        Me.BindingConte xt(DsApplicants 1, "tblApplicants" ).AddNew()

        Dim frmName As New Form1
        Me.Hide()
        frmName.Show()

        I have no problem entering the info or browsing through the forms, but once I check the access file, it hasn't been updated ( a new row hasn't been added).... Can you please tell me where I'm wrong??

        Comment

        Working...