1

I would like to import a dbf table (FoxPro) into a temporary MS Access table and copy 2 columns into a final one before deleting the temp one.

My code looks like this

'read all data into temp table
DoCmd.TransferDatabase acImport, "ODBC Database", DSNCONNECTIONSTRING, acTable, "BEL_PLZ", "Belegungsplaetze_Temp", False
'update table
With CurrentDb
    .Execute "INSERT INTO Belegungsplaetze (Belegungsplatznr,Bezeichnung) " & _
            "SELECT NR,BEZ FROM Belegungsplaetze_Temp t " & _
            "WHERE NOT EXISTS(SELECT 1 FROM Belegungsplaetze s " & _
            "WHERE t.NR = s.Belegungsplatznr) "
     .Execute "UPDATE Belegungsplaetze SET Belegungsplatznr = Trim([Belegungsplatznr]);"
End With

The problem I'm facing is that the column NR from Belegungsplaetze_Temp is a string and I would like to have it as an integer in my final table (final table has 2 columns Belegungsplatznr = Int and Bezeichnung = short text)

2

1 Answer 1

1

This answer's credit belongs entirely to serakfalcon, as they provide a completely valid anwser in the comments of the question.

Use the Val(NR) function to convert Text values into numbers. Microsoft documentation. And some Type Conversion Functions.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.