Page 7 of 7 FirstFirst 1234567
Results 91 to 100 of 100
  1. #91
    ingarchsf is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    50
    June7, there are too many words in those links.. I can't read them completely.. I'm not that kind of person.. I want to try by myself in doing things!



    There are some expression that I can't understand.. I clicked on "debug" in he error window, and searched the error code.. stop!

    Why there are [Field] and ![Field].. i come from Pascal programming.. I don't know anything about that!!

    PS: I've removed ' but.. the same.. too many parens

  2. #92
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Nothing wrong with trying by yourself but you aren't trying by yourself - you are getting help and guidance from this forum. What's wrong with a little more help and guidance from the referenced links?

    The apostrophes and parens are unrelated issues. Carefully read my explanation and should see that.

    Unless you want to provide db for analysis, I can't help any more. The code examples provided are adequate guidance for what you want to do.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #93
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    @ingarchsf,

    I've lost track of what the problem is now. I copied your code from post #79 and added it to my example dB. I had to modify the query for the report, but the export seems to work.
    If Italian names can have apostrophes embedded in them (like O'Brian), the apostrophe needs to be doubled because the apostrophe is a delimiter in Access/SQL.

    I added a function to do that - see the code.
    And I added a format to the "sCriteria" line for ![Data_modulo]...

    Everything seems to work OK. I attached the example dB. You should be able to adapt the code to your database.

  4. #94
    ingarchsf is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    50
    @ssanfu
    ehehe, too many posts!!!
    First, thank you! Ok for the apostrophes, new thing learned. Infact I have some, but I solved the problem using a similar symbol, so that Access doesn't recognize it as the "official" apostrophe.

    The db now is ok (I will have a look at the one you have uploaded, to compare it with the final version of the one made till now).

    The last "problem" (that is not a problem :P ) is: now I can export PDF as I needed, and I'd like to edit that code (on another button) not to make an output but only to search, just to see pages (all together is ok) before exporting them. I removed the lines about "exporting" from the code, but I can visualize only 1 page, and not all the pages that come from sCriteria.
    The code is the following:
    Code:
        Dim MyDB As DAO.Database
        Dim MyRS As DAO.Recordset
        Dim strSQL As String
        Dim strRptName As String
        Dim sCriteria As String
        Dim strWhere As String                  
        Dim lngLen As Long                
    
        Set MyDB = CurrentDb
        strRptName = "Attestati_2014"
        
        If Not IsNull(Me.qcognome1) Then
            strWhere = strWhere & "(Cognome Like ""*" & Me.qcognome1 & "*"") AND "
        End If
        
        If Not IsNull(Me.qncorso1) Then
            strWhere = strWhere & "(N_corso = " & Me.qncorso1 & ") AND "
        End If
        
        If Not IsNull(Me.qnmodulo1) Then
            strWhere = strWhere & "(N_modulo = " & Me.qnmodulo1 & ") AND "
        End If
       
        lngLen = Len(strWhere) - 5
        If lngLen > 0 Then
            strWhere = "WHERE " & Left$(strWhere, lngLen)
        End If
        
         strSQL = "Select Selezione_corso_2014.[Cognome], Selezione_corso_2014.[Data_modulo],Selezione_corso_2014.[Nome]  From Selezione_corso_2014 " & strWhere & ";"
        
        Set MyRS = MyDB.OpenRecordset(strSQL, dbOpenForwardOnly)
        
        With MyRS
                sCriteria = "[Cognome]='" & ![Cognome] & "' and [N_corso]='" & ![N_corso] & " and [N_modulo] = " & ![N_modulo] & ""
                DoCmd.OpenReport strRptName, acViewPreview, , sCriteria
        End With
        MyRS.Close
        Set MyRS = Nothing
        MsgBox "Done"
    and the error is: 3075, too many parenthesys in (Cognome = ) AND (N_corso = 1) AND (N_modulo = )


    @June7
    Well.. I can't understand that thought: I only asked for a help because it's not my job and I only needed a help in costructing something that is not familiar to me!

    If I wanted to learn or if I knew VBA, I would have done by myself. I'm not a person that ask because doesn't want to do..

    I come from another field of work, and I only asked.. I can't learn now how to build VBA in 1 week! I will do it in my sparetime! If it is too complicated to explain, give up! I'm not forcing anyone.. but please, don't ask me to read a course or a long explanation of VBA now.. I can't understand..

    I prefer learning by doing, and it's what I'm doing.. and I learned so much, starting from what you had written and from ssanfu first example-DB.
    I can't provide the DB.. it contains private data of people. I can't!!

  5. #95
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    and I'd like to edit that code (on another button) not to make an output but only to search,
    I would use a form, but it sounds like you want at printout.

    For the print out code, remove any lines that deal with strSQL, MyRS or sCriteria. (and the message box line)
    In the Docmd line, you should replace "sCriteria" with "strWhere". You might have to modify the saved query for the report.

    I would use a form rather than a report..... but that is me.


    I prefer learning by doing,
    Since you like to tear apart dB's to learn (I do also), attached is a dB with both options.

    Don't peek until you have your code working or you get really stuck.

  6. #96
    ingarchsf is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    50
    Hey, I'm still trying, as you told me
    I have had not so much time!

  7. #97
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    If you can't sanitize the db enough to provide for analysis, I give up! And that doesn't happen often.

    The code and examples provided are proven solutions. Can't see anything wrong with the code you posted, so why YOUR code is not working can't be determined unless we can analyze YOUR db.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #98
    ingarchsf is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    50
    here I am!

    @ssanfu: I've tried first following advices, then looking at the example.
    There two things I can't understand:
    1) in the "Preview" mode, with the Report opened and not exported, if I choose o insert only one parameter, it says "Runtime error 3075", related to parethesys in excess. With two parameters is ok!
    2) in the "list" mode, nothing happens.. I linked the field with the boxes, but in each box appears "#Name?".. I tried to verify on yours, but if I link the field (i.e.) "Cognome" of the Query1 to the box under "Cognome" label, the same "#Name?" appears also in yours..

    @June7: thank you for your help.. but, really, I can't provide any DB.. it should be written again totally.. and giving a blank DB is not useful.. I has ALL confidential data, and I can't risk.. sorry!

  9. #99
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    1) in the "Preview" mode, with the Report opened and not exported, if I choose o insert only one parameter, it says "Runtime error 3075", related to parethesys in excess. With two parameters is ok!
    Your request was for 2 parameters. The code expects (requires) two parameters. You would have to add VBA to check if each parameter has data.

    2) in the "list" mode, nothing happens.. I linked the field with the boxes, but in each box appears "#Name?".. I tried to verify on yours, but if I link the field (i.e.) "Cognome" of the Query1 to the box under "Cognome" label, the same "#Name?" appears also in yours..
    I don't know what you mean by "List Mode". Would need more info and to see your code.

  10. #100
    ingarchsf is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    50
    Quote Originally Posted by ssanfu View Post
    Your request was for 2 parameters. The code expects (requires) two parameters. You would have to add VBA to check if each parameter has data.
    Yes, I thought that the control clause "if not isnull..." was the check ahaha..
    btw, something strange but useful has happened: if I insert only one parameter, it shows "3075" error, BUT if I insert first 2 parameters and then I delete one of the two, it works with only 1 parameter!! O_O..

    Quote Originally Posted by ssanfu View Post
    I don't know what you mean by "List Mode". Would need more info and to see your code.
    With "List Mode" I mean the filtered view, with the list of records. At the beginning I didn't understand how to build it, but then I've found the button "Add existing fields" and the.. pooff.. it works!! And.. I've found also the option "Continuous form".. so, perfect!

    I can use both views (Filtered and Preview) in two different ways, and both are useful.

    I've made some edits on the "visualization" so that it works as I need.
    Ok, there are some bugs or layout features to be corrected, but.. seems ok!

    I want to try to empty confidential data (so, all the tables...) and send.

Page 7 of 7 FirstFirst 1234567
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 06-04-2014, 01:25 PM
  2. Export as PDF
    By lugnutmonkey in forum Import/Export Data
    Replies: 1
    Last Post: 02-19-2013, 11:23 AM
  3. Export to Word
    By Monterey_Manzer in forum Import/Export Data
    Replies: 0
    Last Post: 12-20-2012, 02:06 PM
  4. CSV Export
    By mchadwick in forum Access
    Replies: 1
    Last Post: 09-06-2011, 03:19 PM
  5. Export
    By vvasudev in forum Import/Export Data
    Replies: 2
    Last Post: 01-20-2010, 11:42 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