Results 1 to 3 of 3

Thread: Help! Coding a List filed with file names using a SQL statement in VB

Hybrid View

  1. #1
    Junior Member
    Join Date
    Jul 12
    Location
    Here
    Posts
    18

    Help! Coding a List filed with file names using a SQL statement in VB

    Hello all!

    i am importing several data files into one database in Access. I am trying to code a list field with the file names the data was imported from, using a SQL statement. This is what i have so far:
    Code:
    If Right(objF1.Name, 3) = "CSV" Then
    FileName = objF1.Name
    DoCmd.TransferText acImportDelim, "ImportSpec", "ELDO_COMBINED", orgLocation & objF1.Name, False
    
    DoCmd.SetWarnings False
    DoCmd.RunSQL "UPDATE ELDO_COMBINED '" & FileName & "' WHERE ELDO_COMBINED.LIST IS NULL ;"
    DoCmd.SetWarnings True
    
    MsgBox objF1.Name
    End If
    Next
    The red line is the SQL statement i came up with that is not working, any help would be awesome!

  2. #2
    PowerPoster
    Join Date
    Dec 04
    Posts
    18,520

    Re: Help! Coding a List filed with file names using a SQL statement in VB

    i am not sure you can match to null like that, not that i have tried
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3
    Junior Member
    Join Date
    Jul 12
    Location
    Here
    Posts
    18

    Re: Help! Coding a List filed with file names using a SQL statement in VB

    i want the records to be coded with the file name in which they were imported from

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •