Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1473
  • Last Modified:

Infopath and VBA

Hi

I have had some great feedback on how to connect a new InfoPath form
to an Access database using the wizards provided.
Now I'd like to fin out how to communicate with Access in Infopath using VBA.

What VBA code (no wizards) would I use to save data from the following three
InfoPath controls to an Access database with matching columns

Text1 (TextBox)
Date1 (Date)
Number1 (Number)
0
Murray Brown
Asked:
Murray Brown
  • 2
1 Solution
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
I don't use InfoPath, but couldn't you just use standard SQL to do this:

[Assuming you have a reference in InfoPath to the DAO library]
Dim dbs As DAO.Database
Set dbs = DAO.OpenCurrentDatabase("full path to your access db")
dbs.Execute "UPDATE SomeTable SET Col1='" & Me.Text1 & "', Col2=#" & Me.Date1 & "#, Col3=" & Me.Number & " WHERE YourIDField=" & Me.TheRecordIDValue

dbs.Close
Set dbs = Nothing

Again, I know little of InfoPath (other than most people avoid it, for various reasons). If your intent is to collect data via email, you're better off either (a) just not doing it, and building a webpage for people to use or (b) using an Excel spreadsheet attached to the email, and processing that when it is returned. I have been involved in projects like this, and we considered InfoPath, but instead went the route of trying to build our own email "form", using HTML email and identifiers/tags in the HTML. It worked _most_ of the time, which is a bad thing in the world of data.
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks very much for the feedback. I am doing the project for a client who sells medical parts and seems to enjoy Infopath. I am very much an Excel/Access/VB.net/ASP.net person and moved into ASP.net because a webpage is clearly a much better way of gathering data. I am curious as to why Infopath is used with Sharepoint though. I will post a further question and paste the link below
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now