Hi all,
I'm new to VBA, but have been working with VB for sometime now. I have a very basic question that I would have no trouble with in VB.Net, but here it goes. I am trying to insert data from a form that I made into a table in the database. I've made the query for the insert with all of the parameters outlined. WHen I press the submit button I want it to send the corresponding text box values to the query, so it will add to the table. The only problem is I really am having some troubles. This is as far as I could go
VB Code:
Dim db As Database Dim qry As QueryDef Const strQueryName = "Camp_Create_InsertInto_Student_Info" Set db = CurrentDb() qry.Parameters("@Student_Fname") = FirstName.Value qry.Parameters("@Student_Lname") = LastName.Value qry.Parameters("@Student_Age") = Age.Value qry.Parameters("@Student_DOB") = DOB.Value qry.Parameters("@Student_GardianName") = Gardian.Value qry.Parameters("@Student_Address") = Address.Value qry.Parameters("@Student_Apt") = Apt.Value qry.Parameters("@Student_City") = City1.Value qry.Parameters("@Student_State") = State.Value qry.Parameters("@Student_Zip") = Zip.Value qry.Parameters("@Student_HomePhone") = Phone.Value qry.Close db.Close
It gave me problems. This code is in the onClick event procedure for the button on the form. I'm very lost and could really use some help with this simple but important part of developing something within Access. Please help.
Cran56




Reply With Quote