Search results

  1. P

    Export data fields based on checkboxes on Form

    Nope. OK, I cleaned up the code to keep necessary lines: 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...
  2. P

    Export data fields based on checkboxes on Form

    It doesn't higllights any line, just error windows pops up.
  3. P

    Export data fields based on checkboxes on Form

    Looks like the way I did it doesn't work for random picked fields, so started to try your code. Here is what I have just now, simply trying to run simple SELECT before I start creating tables and exporting it etc I'm getting error saying: "Error updating: Object doesn't support this property...
  4. P

    SELECT INTO with Identity - getting error

    taking off Set, gives me error Expected Array EDIT: OK, I got it working. I did a separate function and called it later. Function TableExists(strTableName As String) As Boolean On Error Resume Next TableExists = IsObject(CurrentDb.TableDefs(strTableName)) End Function Then... If...
  5. P

    SELECT INTO with Identity - getting error

    I got this, but gives me error that Object required... Dim strTableName As String Dim TableExists As Boolean Set TableExists = IsObject(CurrentDb.TableDefs(strTableName)) If TableExists("Data Export") = True Then DoCmd.DeleteObject acTable, [Data Export] End If
  6. P

    SELECT INTO with Identity - getting error

    I wanted to run this but for some reason it doesn't work. https://docs.microsoft.com/en-us/sql/t-sql/functions/identity-function-transact-sql?view=sql-server-ver15 But ok, I will run in steps, first create table with Autoincrement and other fields, then add data. Another question: how can I...
  7. P

    SELECT INTO with Identity - getting error

    Yes, first I want to create this new table from data from other table, but as well add first ID which would be autonumber. I wanted to do it at one step. Next would be export, but first I need this table created. Of course I could run second sql line and alter table adding it, but I want it to...
  8. P

    SELECT INTO with Identity - getting error

    But this Identity field is new, I'm adding it first, then take fields from other table. When I got rid of =, it didn't work. Tried newID Identity(1,1),... or Identity(1,1) as newID. Nothing worked. Do I have to somehow declare this function first?
  9. P

    Export data fields based on checkboxes on Form

    Thanks guys, it took me a while to use your suggestion, but its working great! :) Thank you all! I decided to create a table first with this data, then export it. I have new problem, wanted to simply add autonumber first in this new table and for some reason when running SELECT newID =...
  10. P

    SELECT INTO with Identity - getting error

    [SOLVED] SELECT INTO with Identity - getting error I'm getting an error (Undefined function 'IDENTITY' in expression) when trying to run this line: strSQL = "SELECT newID = IDENTITY(1, 1), Data.Company, Data.Title, Data.Fullname INTO [Data Export] FROM Data ORDER BY Data.ID" Also tried...
  11. P

    Export data fields based on checkboxes on Form

    I have a form with all table fields listed and check boxes next to them. What I'm trying to achieve is to export all data fields that user selects to txt file. Problem is it would need to check which check-box is picked, then export only these fields. How can I do that in VB? Could I write...
  12. P

    Reference to Form fields in Update

    Aaaah, thanks, I'll practice this.
  13. P

    Reference to Form fields in Update

    Yes, What I've done is I decided that minimum of 5 fields must be mapped. Then built conditions for rest of them. See, I'm not a developer, but I would love to know how to do it your way No.1 or No.2:)
  14. P

    Reference to Form fields in Update

    Hello!:) I've continued working on this db and came up on another problem. It all works fine when I "map" exact number of fields. My query in code had 23 fields as this is total amount of fields in "Data" table (processing one where data is inserted to). However "Source" table (imported one)...
  15. P

    Reference to Form fields in Update

    Yep, worked again! Now I can map other fields. Thank you very much for your help:)
  16. P

    Reference to Form fields in Update

    Holy S*** it worked!!!! :eek::D Thank you thank you !!!! You always answer all my questions in minutes, you sure you're not some kind of forum bot? :D OK, now I'm gonna try to point second part of the puzzle - that form has another dropdowns with destinations fields (Data table) - so this way...
  17. P

    Reference to Form fields in Update

    Sorry, I really appreciate your help. Fixed it, gives me error: Compile error: Invalid use of Me keyword" I've read some about "active" attribute. How can we "point" to active form? I believe "Me" was going to do that?
  18. P

    Reference to Form fields in Update

    Something is missing there, all line goes red. As far as I understand this code will simply pull data from ImportTable and add it to Data table. Straight from it, not via form. Reason for the form is that I want user to pick which fields he wants to insert, so it needs to come from form...
  19. P

    Reference to Form fields in Update

    OK, got it:) It says: INSERT INTO [Data] ( Address1, Address2 ) SELECT [Form_MappingTables].Source_Address1,[Form_MappingTables].Source_Address2 FROM [ImportTable]
  20. P

    Reference to Form fields in Update

    Sorry, you lost me... Do what? I know that my SQL string is wrong as this isn't a table, but form. What I want it to do is to look at the form, get data fields names from dropdowns and get that data from ImportTable. I added these: Dim tbl2 As String tbl2 = "ImportTable" I fixed SQL to...
Back
Top Bottom