SQL - VBA Help Needed!!

Dragonreaper

Php-Junkie
Local time
Today, 02:48
Joined
Feb 7, 2008
Messages
31
Ok i have a database works fine just run into a little porblem..
In My VBA Coding i have made a SQL quiery the code is..
Code:
Private Sub Form_AfterInsert()

DBEngine(0)(0).Execute "INSERT INTO availability (ID) " & _
" VALUES (" & Me.ID & ")", dbFailOnError

'---------------------- Below Is The Code That -----------------------
'-------------------------- Doesn't Work -----------------------------

DBEngine(0)(0).Execute "INSERT INTO availability (Name) " & _
" VALUES (" & Me.Name & ")", dbFailOnError

'----------------------------------------------------------------------

End Sub

ok so the insert of ID works but the insert of Name does not..

Am i doing something wrong?? can somebody help please i need it urgent..

P.S.
i have been using MySQL for about a Year working on PHP and it seems much different from this SQL here on access.. and my suggestion would look something like this
Code:
"INSERT INTO availability ('ID','Name'), VALUES ('Me.ID','Me.Name')

Something along Those Lines..

- Alan
 
Ok figured It Out =]
Code:
 Dim SQL As String

SQL = "INSERT INTO availability (ID, Title, Name, Surname) " & _
"VALUES ([ID].Value, [Title].Value, [Name].Value, [Surname].Value)"

DoCmd.RunSQL SQL

so there it is if you want to know what i was doing lol :D
 

Users who are viewing this thread

Back
Top Bottom