Heather Dragon
Heather Dragon

Reputation: 51

INSERT INTO table in access from inputbox

I'm stumped - and also very new to VBA in access but here is my intent:

I have want the member to select a "Begin" button in access, from there, multiple inputboxes will pop up allowing the user to enter data. I want the data entered (name, date, etc.) to be stored into a label on the form, and at the end the next person who opens the "begin" button has a fresh bunch of inputboxes pop-up and their data is then stored in each label of form. End game, a pretty form is emailed to me.

I've mastered the inputboxes and msgboxes - they pop up and run all the way through. The problem I'm at is when the user enters their information I need it to go onto the form into the appropriate fields so in the end the form can be "printed" as a .pdf and sent to me. Any help would be greatly appreciated!

Sub Begin()

Dim AddName As String
Dim AddAddress As String
Dim AddSupv As String
Dim AddPhone As String

AddName = InputBox("What is your rank and full name?", "Enter Rank and Name")
AddAddress = InputBox("What is your home address? Please include street, city, state and zip.", "Enter Address")

Where is any, would I add a function to insert the data after each inputbox into a field on my form. Form Name is Form1 and I also have a table labeled 'AUS Table' that have fields called 'Name_and_Rank' and 'Address' if the inputbox data must go to a table first.

Upvotes: 0

Views: 724

Answers (1)

June7
June7

Reputation: 21370

Variables are not needed, just reference controls.

For label controls:
Me.lblName.Caption = InputBox("What is your rank and full name?", "Enter Rank and Name")
Me.lblAddress.Caption = InputBox("What is your home address? Please include street, city, state and zip.", "Enter Address")

For textbox controls:
Me.tbxName = InputBox("What is your rank and full name?", "Enter Rank and Name")
Me.tbxAddress = InputBox("What is your home address? Please include street, city, state and zip.", "Enter Address")

But if there are textboxes on form, users should just type directly into textboxes.

Upvotes: 1

Related Questions