Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 40
  1. #16
    WithoutPause is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Nov 2013
    Posts
    62

    If I type in the value, it works properly. If I have the form open with the value already there, the value doesn't get passed.

  2. #17
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Can you post the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #18
    WithoutPause is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Nov 2013
    Posts
    62
    The actual DB file that would be about 10MB of data or just the structure of the DB? One table has 151 fields so I don't feel like writing that out. I'll have to strip table data if you mean uploading the actual DB file.

  4. #19
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Well maybe this wil help then....

    post #11 has an issue with the strWhere = "[C01] = " & C01
    should be
    strWhere = "C01 = '" & Me.C01 & "'"

    Then post # 14 seems like it is looking for where Criteria. I count only three commas after the name. If you want openargs I believe you need 6 commas after the name of the form you are opening. Check your intelisense as you type.

  5. #20
    WithoutPause is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Nov 2013
    Posts
    62
    Here's the code I'm using and what is happening.

    1. If I enter data into C01, and it finds the record, it passes the data correctly.
    2. If I enter data into C01, it doesn't find the record it says it isn't found.
    3. If the field is left blank, it says the C01 field needs to be filled.
    4. If I then enter valid data that should find a record after that, it passes nothing.

    So having a blank field somehow is tripping up the code.

    Code:
    If Not IsNull(Me.C01) Then
            '
            Dim db As DAO.Database
            Dim rcdFindMatch As DAO.Recordset
            Set db = CurrentDb
            Set rcdFindMatch = db.OpenRecordset("Complaint", dbOpenDynaset)
                Dim strWhere As String
                
                strWhere = "C01 = '" & Me.C01 & "'"
                
                rcdFindMatch.FindFirst strWhere
                
                If rcdFindMatch.NoMatch Then
                    MsgBox "The grievant number does not exist", vbInformation, "Grievant Numnber Not Found"
                    rcdFindMatch.Close
                    Set rcdFindMatch = Nothing
                    C01.SetFocus
                    Exit Sub
                Else
                    DoCmd.OpenForm "frmFactSheet", , , "C01 = '" & Me.C01.Value & "'"
                End If
            '
        Else
            MsgBox "Please enter grievant number."
            Me.C01.SetFocus
        End If

  6. #21
    WithoutPause is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Nov 2013
    Posts
    62
    Double post.

  7. #22
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    You have a line of code that is opening a form with a specific criteria. If the criteria is not met, the form will not open.

    DoCmd.OpenForm "frmFactSheet", , , "C01 = '" & Me.C01.Value & "'"

    There has to be a value in the current record as well as matching criteria in the recordset of the form you are opening for this to work.

  8. #23
    WithoutPause is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Nov 2013
    Posts
    62
    Ok, so let's say I change the Docmd to the six comma version and want to pass the record set recFindMatch as part of the Open Args. Are the recordset fields separated by tabs and how would I represent that separation if I was just passing form fields? Me.C01 & (Tab) & Me.C02? I want to keep my separators consistent so when I use the second form I don't need to be factoring in multiple separators.

  9. #24
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    I am not sure what you are referring to. Didn't you have a working example of OpenArgs in Post # 7? Maybe you can go back to that and the link Paul provided.

  10. #25
    WithoutPause is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Nov 2013
    Posts
    62
    The OpenArgs code in step #7 was in regards to what I was trying to do in step 1 in post #1. The DB related code doesn't need to be there. For what I'm trying to do now is I simply need to pass a recordset to a second forum and receive the recordset there.

    The Docmd line is getting me an error.
    Code:
    If Not IsNull(Me.C01) Then
            '
            Dim db As DAO.Database
            Dim rs As DAO.Recordset
            Set db = CurrentDb
            Set rs = db.OpenRecordset("Complaint", dbOpenDynaset)
                Dim strWhere As String
                
                strWhere = "C01 = '" & Me.C01 & "'"
                
                rs.FindFirst strWhere
                
                If rs.NoMatch Then
                    MsgBox "The grievant number does not exist", vbInformation, "Grievant Numnber Not Found"
                    rs.Close
                    Set rs = Nothing
                    C01.SetFocus
                    Exit Sub
                Else
                    DoCmd.OpenForm "searchFrmFactSheet", acNormal, , , , , rs
                End If
            '
        Else
            MsgBox "Please enter grievant number."
            Me.C01.SetFocus
        End If
    This is the code I use on the On Load event for the second forum.
    Code:
    If Not IsNull(Me.OpenArgs) Then
            Me.RecordSource = Me.OpenArgs
    End If

  11. #26
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Use "Complaint" for the RecodSource of searchFrmFactSheet and place the following code in your click event in the original form. If this isn't working you can try using the wizard and create a control button. It will ask you if you want to show specific criteria and write similar code.

    Dim strWhere As String
    strWhere = "C01 = '" & Me.C01 & "'"
    DoCmd.OpenForm "searchFrmFactSheet", , ,strWhere

  12. #27
    WithoutPause is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Nov 2013
    Posts
    62
    Until I find some other way I'm screwing this up, it does seem to be working now.

  13. #28
    WithoutPause is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Nov 2013
    Posts
    62
    Quote Originally Posted by WithoutPause View Post
    #1
    1. Validate that the key field is filled in.
    2. Pass the needed values into the second form so the user can complete the process on the second form.
    The second form wasn't updating the data like it should have so I went and try to fix it, but the passing of data is giving me a blank screen. ere's what I'm trying to do.

    Let's say I have 10 fields I fill out in Form A. I then click on a button to pass 5 of those fields to Form B. Forum B has 20 fields total. If I had Form B allow additions, I was getting an error since I was passing the key field to a bound text field. I changed it to be unbound for it and the other passed fields. Since these fields are not enabled, this is OK. I do have the additional fields bound and enabled. Again, when I click on the button in Form A, Form B is simply blank. I tried passing the data via a typical search, but the record wasn't found. I can see an issue with the data being updated but not being tied to a record as well, but I'm not sure. The data seems to be passed correctly but again, the form ends up blank.

    OnClick code post validation.
    Code:
    DoCmd.OpenForm "frmFactSheet", , , , , , Me.C01 & ";" & Me.C02 & ";"..... ' More data
    DoCmd.Close acForm, "frmComplaint"
    Onload for Form B
    Code:
    Private Sub Form_Load()
        Dim strOpenArgs() As String
        
        If Not IsNull(Me.OpenArgs) Then
            strOpenArgs = Split(Me.OpenArgs, ";")
            Me.C01 = strOpenArgs(0)
            Me.C02 = strOpenArgs(1)
            Me.C03 = strOpenArgs(2)
            Me.C04 = strOpenArgs(3)
            Me.C05 = strOpenArgs(4)
        End If
    End Sub

  14. #29
    WithoutPause is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Nov 2013
    Posts
    62
    http://allenbrowne.com/casu-20.html

    I used the above link to get my form to show. The issue now is that the form doesn't update the record. I used a couple different solutions to solve the blank form issue and yet neither led to a form that updates the record. The form does allow edits. I currently have all of the fields bound and use the before update event. If I use Data Entry No, Allow Additions No, and don't use the Before Update event, it still doesn't update.

  15. #30
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Can you post the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. passing values from form to query
    By gregd in forum Access
    Replies: 6
    Last Post: 05-02-2013, 03:18 PM
  2. Replies: 5
    Last Post: 10-15-2012, 12:18 AM
  3. Passing Multiple selection values to a report
    By techexpressinc in forum Forms
    Replies: 7
    Last Post: 01-13-2012, 02:27 PM
  4. Replies: 1
    Last Post: 03-24-2010, 08:42 AM
  5. Replies: 3
    Last Post: 06-02-2009, 09:51 AM

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