Search results

  1. P

    Edit cells in csv file via VBA

    It worked perfectly! Thank you again:) Now I need to google bits from it, I want to learn what exactly it does :D
  2. P

    Edit cells in csv file via VBA

    Oh, I see, thanks. I thought its some value I need to type in :) I'll try and add your code to mine, will get back once tested :)
  3. P

    Edit cells in csv file via VBA

    Thank you, I need to try it out. What does this "scripting.filesystemobject" mean here?
  4. P

    Edit cells in csv file via VBA

    Dot and # is another problem I found. when working on that export extra rows. Access doesn't export # as first character in header, it automatically changes it to dot. I don't know why, but it does that.
  5. P

    Edit cells in csv file via VBA

    Thanks guys for your responses. Sorry not getting back earlier, I was caught in different project and now came back to this one. Yep, problem with union would be data types, I think. But I got it working other way. I found this solution somewhere and it works. I used FreeFile(), then Open For...
  6. P

    Edit cells in csv file via VBA

    I have a csv file with exported data form Access. Problem is that I need to add 2 rows on top of the data in that csv. Simply push down all data I exported in that csv (including headers) and add 2 rows with specific values. I managed to write a vba to push whole data down by 2 rows, however...
  7. P

    Export data fields based on checkboxes on Form

    Thanks for looking into it, I appreciate it. Right, so if I split that condition, will check for checkboxes, got it. Then if it has a tag - so you are saying all will have tags so I shouldn't be checking this? I think I understand what you mean about not using On Error Resume Next. Thanks...
  8. P

    Export data fields based on checkboxes on Form

    Hi guys, sorry for not getting back with this db, I was extremely busy last month. So please find attached my db - it has this CreateExportTable function, where I commented out error handling that was giving me error. It works fine when commented out, but crashes when I bring that back in:(...
  9. P

    Export data fields based on checkboxes on Form

    OK, I got it working now. Using TableDef I loop through all fields and just skip that one particular field, then run SELECT and put that field first, then whole string with looped fields. Thanks for explaining that I could use DMax to get a simple ascending Order ID field - this is very useful...
  10. P

    Export data fields based on checkboxes on Form

    From what I've read, it is not that trivial - I forgot to mention - fields are random, not always the same, so I cannot simply list them. It needs to be reformatted from *,[that field] to [that field],* I need to either re-write all ordinal positions of fields, or somehow move last field to be...
  11. P

    Export data fields based on checkboxes on Form

    While working on that error handling issue, I have another question. I have a table and want to run query to view this table's fields in specific order - taking last field to be first. I spent hours on reading about OrdinalPosition, re-creating the table, selecting * except one field and then...
  12. P

    Export data fields based on checkboxes on Form

    Did these: 1. Both solutions still give me same error. 2. Yep, set on unhandled errors 3. Removed. 4. I realised that I will need this table created anyway, so I create it then will export, no probs. 5. Righto, I used to use Macro "ImportExportText", as don't know how to write a code for...
  13. P

    Export data fields based on checkboxes on Form

    OK, I've run debug - it stops on second loop on this line: If ctl.ControlType = acCheckBox And ctl = -1 And ctl.Tag <> "" Then It goes through ok first time, then loops back and stops at second run. Does it mean that one of the objects on that form is killing it? Second checkbox is not...
  14. P

    Export data fields based on checkboxes on Form

    I don't get it.. error handling keeps giving me this error. I commented out all those lines, so it works fine. I just gonna continue working on it without. Not ideal, but at least it works. Now I made it SELECT INTO and it creates a nice table that will be exported later on by another macro.
  15. P

    Export data fields based on checkboxes on Form

    Here is latest code: Public Function CreateExportTable() As Boolean On Error Resume Next Dim ws As Workspace Dim db As DAO.Database Dim strSQL As String Dim table1 As String Dim frm As String Dim Form_Export As Form Set ws = DBEngine.Workspaces(0) Set db = ws.Databases(0) frm =...
  16. P

    Export data fields based on checkboxes on Form

    It's working fine, but for some reason when I add back my error handling, it comes up with this error: "Error updating: Object doesn't support this property or method" Why is that?
  17. P

    Export data fields based on checkboxes on Form

    Cool! Thanks:) I just added one line there as at the end I was getting ", FROM": StartCheck: X = Len(strSQL) strSQL = Replace(strSQL, ", ,", ",") strSQL = Replace(strSQL, ", FROM", " FROM") Y = Len(strSQL) If Y < X Then GoTo StartCheck
  18. P

    Export data fields based on checkboxes on Form

    OK, now when I fixed all tags, all work fine when I tick all of them (25 check boxes), however I get double comas. Also, when I tick random ones, I get this: SELECT SourceID, , , , , , , , Surname, , , , Address1, , Address2, , , , , , , Postcode, , , , , , , , , , FROM Data
  19. P

    Export data fields based on checkboxes on Form

    Sorry, I fixed the code, it looks now like this: Public Function CreateExportTable() As Boolean On Error Resume Next Dim ws As Workspace Dim db As DAO.Database Dim strSQL As String Dim table1 As String Dim frm As String Dim Form_Export As Form Set ws = DBEngine.Workspaces(0) Set db =...
  20. P

    Export data fields based on checkboxes on Form

    Hi, sorry, yes I saw it - I got rid of most extra lines to make it short and simple, including error handling.
Top Bottom