98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Access VBA Training and help » Access VBA
Access VBA
Resolved · Low Priority · Version 2007
Louise has attended:
Access Advanced course
Access VBA course
Excel Pivot Tables course
Access VBA
Hi
I am trying to take one field from a form and populate a different table with it. I think the error is coming from the set rsttable but I can't see what I've done wrong. Can you help me???
Dim dbData As DAO.Database
Dim rstTable As DAO.Recordset
Dim strsql As String
Set dbData = CurrentDb()
Set rstTable = dbData.OpenRecordset([Tbl Date])
strsql = "INSERT INTO Tbl Date ([sunhsno]) VALUES (" & Me.SUNHSNo.Value & ")"
DoCmd.RunSQL strsql
RE: Access VBA
Hi Louise, thanks for your query. Capture the field from the form in a variable as follows:
myVariable = txtMyFormField
Then concatenate myVariable into the SQL for an Update query and voila!
Hope this helps,
Anthony
Wed 6 Jun 2012: Automatically marked as resolved.
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |