Results 1 to 8 of 8
  1. #1
    cotri is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Jan 2010
    Posts
    32

    Commas in CSV file


    I have some fields in a record that are being exported to another type of program using a CSV file. Everything was working fine until one time a comma was used in one of the exported fields. To prevent this problem in the future I would like to not permit commas in these fields that will be exported at the time the data is being inputted. I have seen that “ “ in the field would prevent this but unless there is a method to easily hide this in the background without any user input I don’t mind just not allowing commas.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You could use the Replace() function in the BeforeUpdate event of the control.

  3. #3
    cotri is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Jan 2010
    Posts
    32
    Quote Originally Posted by RuralGuy View Post
    You could use the Replace() function in the BeforeUpdate event of the control.

    Sorry I’m new to all this. Do I need to build an “expression” and if so what will it look like? I keep getting errors. In the “properties” of the selected field will this expression be in the “Control Source” or “Before Update”? Thanks for the help here.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You need to get to the Event tab of the property sheet for the control and press the "..." button and select CODE. That will create a stub for the event on the class module for the form. Copy that stub into your next post so we can see it.

  5. #5
    cotri is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Jan 2010
    Posts
    32

    Delete all Records in Table

    I am looking to put a “Command Button” on a form to delete all records in a table. I found a Macro the deletes the whole table but I just want to delete the records. Any Ideals? Thanks

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You tagged onto an old thread of yours that was never marked as completed. You just posted a new issue that needs a new thread. You should also tell us how you solved the original issue so others reading this thread can learn too.

  7. #7
    cotri is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Jan 2010
    Posts
    32
    Quote Originally Posted by RuralGuy View Post
    You tagged onto an old thread of yours that was never marked as completed. You just posted a new issue that needs a new thread. You should also tell us how you solved the original issue so others reading this thread can learn too.

    Sorry about that. I meant for it to be a new thread and realized right after I sent it that something was different. Will repost this new issue by itself.

  8. #8
    cotri is offline Advanced Beginner
    Windows XP Access 2000
    Join Date
    Jan 2010
    Posts
    32
    Quote Originally Posted by RuralGuy View Post
    You need to get to the Event tab of the property sheet for the control and press the "..." button and select CODE. That will create a stub for the event on the class module for the form. Copy that stub into your next post so we can see it.
    Here is the code for my "ShipToZipCode" field. As well as looking up the City and State for the given Zip Code it also allows a new City and State to be added to the Zip Code table if a new Zip Code is being used thats not in the table. Thanks


    Private Sub ShiptoZipCode_AfterUpdate()
    Dim sNewCity As String, sNewState As String
    Dim iSaleNumber As Long
    iSaleNumber = Me![SaleNumber]

    If FindFieldValue("ZipCode", "ZipCodeToCityState", Me![ShiptoZipCode], 0) = "FAIL" Then
    sNewCity = GetNewZipCode("City", Me![ShiptoZipCode])
    sNewState = GetNewZipCode("State", Me![ShiptoZipCode])

    AddNewZipCodeRecord "ZipCodeToCityState", Me![ShiptoZipCode], sNewCity, sNewState
    'MsgBox Me![SaleNumber]
    ' Me![ShipToState] = sNewState
    ' Me![ShiptoCity] = sNewCity

    Me![BillingZipCode] = Me![ShiptoZipCode]
    ' Me![BillToCity] = sNewCity
    ' Me![BillToState] = sNewState

    DoCmd.Requery
    DoCmd.GoToRecord offset:=FindRecordOffset("SaleNumber", "TotalFields", iSaleNumber)
    'MMCloseReportsForms
    'MMPickOrdersToExportToUPS
    'MMCloseReportsForms

    ' Me![ShipToState] = Me![BillToState]
    ' Me![ShiptoCity] = sNewCity
    Else
    ' Me![ShiptoCity] = Me![ShiptoZipCode].Column(1)
    ' Me![ShipToState] = Me![ShiptoZipCode].Column(2)
    Me![BillingZipCode] = Me![ShiptoZipCode]
    ' Me![BillToCity] = Me![ShiptoZipCode].Column(1)
    ' Me![BillToState] = Me![ShiptoZipCode].Column(2)
    End If

    Me.Refresh
    Me.ResidentialCheck.SetFocus
    End Sub

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Upload file inside .mdb database file
    By havish in forum Access
    Replies: 0
    Last Post: 07-30-2008, 07:35 AM
  2. Possible to export *.mdb file to *.exe file?
    By slpuiwan in forum Import/Export Data
    Replies: 1
    Last Post: 12-16-2007, 06:52 PM
  3. Commas in a Combo
    By DJFayo in forum Forms
    Replies: 0
    Last Post: 10-18-2006, 12:13 PM
  4. How do you export a file with a unique file name
    By Budman42 in forum Import/Export Data
    Replies: 1
    Last Post: 10-15-2006, 06:10 PM

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