Code:
Dim sqlString As String
sqlString = "INSERT INTO Member (Member_ID, First_Name, Last_Name, Membership_Paid, Notes ,Telephone, Mobile, email, Address_Line_1, Address_Line_2, Address_Line_3, County, Country, Membership_Account, Family_ID) VALUES (" & Next_MemberID & ", '" & firstFamilyname & "', '" & Last_Name.Value & "','" & Membership_paid.Value & "', '" & Notes.Value & "', '" & Telephone.Value & "', '" & Mobile.Value & "', '" & email.Value & "', '" & Address_Line_1.Value & "', '" & Address_Line_2.Value & "', '" & Address_Line_3.Value & "', '" & County.Value & "', '" & Country.Value & "', 'Family', " & Next_FamilyID & ")"
DoCmd.RunSQL (sqlString)
I can't understand why this won't work. I've even stored the string in a text file and tried to execute it in the SQL of a query in Access.
It runs, but does not add a line to the table. and no errors.
Am I missing a step? Like commit, or something? Also is DoCmd.RunSQL the right command?
I'm 100% new to vba and access 2007, so any tips would be great. Thanks.
Its a DB I'm creating for a rally club for free.
FYI in the text file it looks like this:
Code:
"INSERT INTO Member (Member_ID, First_Name, Last_Name, Membership_Paid, Notes ,Telephone, Mobile, email, Address_Line_1, Address_Line_2, Address_Line_3, County, Country, Membership_Account, Family_ID) VALUES (386, '3a', 'h','11/11/2008', 'h', 'h', 'h', 'h', 'h', 'h', 'h', 'h', 'h', 'Family', 1)"