Page 1 of 3 123 LastLast
Results 1 to 15 of 33
  1. #1
    ngeng4 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    93

    problem with the updating form

    hello all,
    i have 2 form in my db. 1st - use to add new data. means the blank form
    2nd - use to update or edit the data.

    ive successfully create the 1st form with the blank form onActive.

    but im failed to create the 2nd form. even theres a data in a table, still the data does not appear in a 2nd form. why?



  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    How many different places did you post this?

    Make sure the Data Entry property of the form is No. Personally, I would use one form and open it in one mode or the other.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ngeng4 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    93
    hehehe. i posted this on 3 different forum. ok i have tried ur suggestion but didnt work

  4. #4
    ngeng4 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    93
    if i use only 1 form, then i need to have 2 command button right? for updating and editing. then i know bout the coding for the updating which is for the blank form. but i dont know the coding for the editing.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    The datamode argument of OpenForm would dictate how the form is opened. If the form was bound to the table, using the appropriate argument would open it blank for data entry or displaying existing records.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    ngeng4 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    93
    cant understand..=(..can u xplain it?

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    Start by looking in VBA help on OpenForm, specifically at the DataMode argument.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    Let me get you straight you have two forms one which is meant for data entry always opens blank and the other you intend to use should open with data in it. Now my question are you trying to open the second form from another form based on some criteria? anyways you can try out the following.

    Open the second form in design view and go to Form properties and check Whether Data Entry is set to No, if it is Yes make it no.

    Now if you are opening you form from another fForm using say a CommandButton then you will have a code similar to one below in the OnClick event of the CommandButton

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Main21"

    stLinkCriteria = "[FraudRef]=" & Me![FraudRef]
    DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd


    Check the portion marked in Red if it is acFormAdd then change it to acFormEdit.

    This should solve your problem. if it does please mark this thread solved.

  9. #9
    ngeng4 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    93
    it have 2 command button for each form to open it. 1 for the updating and another is for editing. the editing form shud be open with a data in it.

  10. #10
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    So basically you want to open the same form in different data modes right. Follow the the example code change the part marked in red to acFormEdit.

  11. #11
    ngeng4 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    93
    ive followed what did u said then get the error, for the "[FraudRef]=

  12. #12
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    Well this is an example and you nee to add the names of the fields in your form.

    The example here opens a form called Main21 and displays a record whose FraudRef is = to the FraudRef of a record on a Form called Main Form.


    Now here is what you need to do

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Name of the Form you want to open"

    stLinkCriteria = "[Name of the Field in the form you want to open]=" & Me![Name of the Field from which you want to open another form]
    DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit

    you got this error because you don't have the field name FraudRef do you ha!ha!

    feel free to ask if you have any more problems.

  13. #13
    ngeng4 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    93
    hahahha..shame on me.. i got a lot of problem with this lor.....between, thank you very muchhh

  14. #14
    ngeng4 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Mar 2010
    Posts
    93
    and i also receive this message whenever i tried to add new data to my db by using the form

  15. #15
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    Let me guess you are very new to access right.

    Never mind don't be dissapointed we are all learning:

    Case 1:

    When you want to open a form using a command Button to enter data that means it will be blank!!!

    Name of the Form Main

    The following will be the code:

    Private Sub Command8_Click()
    On Error GoTo Err_Command8_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Main" 'Name of the form you want to open
    DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd 'acFormAdd ensures that the form is opened blank

    Exit_Command8_Click:
    Exit Sub

    Err_Command8_Click:
    MsgBox Err.Description
    Resume Exit_Command8_Click

    End Sub

    Case 2:

    When you want to open a form using a command Button to see all the data in the form


    Private Sub Command8_Click()
    On Error GoTo Err_Command8_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Main" 'Name of the form you want to open
    DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit 'acFormEdit ensures that the form is opened with all the records

    Exit_Command8_Click:
    Exit Sub

    Err_Command8_Click:
    MsgBox Err.Description
    Resume Exit_Command8_Click

    End Sub


    Case 3:

    This is Opening a Form from another Form base on some Criteria. I will use the Code that I had posted for your easy understanding:
    I have two Forms: Main and Main 21

    I have a Field FraudRef on Both Main and Main21

    Now I want to Open Form Main21 From Form Main to Display a Record Where the FraudRef in both the Forms are same.
    e.g. FraudRef in Main = FraudRef in Main21

    Private Sub Command13_Click()
    On Error GoTo Err_Command13_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Main21" 'Name of the Form I want to open

    stLinkCriteria = "[FraudRef]=" & Me![FraudRef] 'I have set the criteria where Main21 for will open and display a record
    DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd 'Whose FraudRef = FraudRef on Form Main

    Exit_Command13_Click:
    Exit Sub

    Err_Command13_Click:
    MsgBox Err.Description
    Resume Exit_Command13_Click

    End Sub

    Three cases are there decide which one you require.

Page 1 of 3 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Problem updating from within a query.
    By Frank Nye in forum Queries
    Replies: 5
    Last Post: 10-14-2009, 10:33 AM
  2. new problem: Updating Combo box
    By ali-gagi in forum Forms
    Replies: 4
    Last Post: 07-06-2009, 07:29 PM
  3. combo not updating form
    By cjamps in forum Forms
    Replies: 5
    Last Post: 04-14-2009, 12:00 PM
  4. Updating Table field from Form
    By Kunuk in forum Access
    Replies: 0
    Last Post: 02-26-2009, 11:41 PM
  5. Updating SQL server form Access form?
    By slash75 in forum Forms
    Replies: 1
    Last Post: 09-06-2008, 02:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums