MS Access VBA Interview Questions and Answers with Examples

Home/100+ VBA Interview Questions and Answers with Examples/MS Access VBA Interview Questions and Answers with Examples

MS Access VBA Interview Questions and Answers with Examples

MS Access VBA Interview Questions and Answers explained with Example macros. Here are the list of most frequently asked basic MS Access VBA interview questions. All the questions are answered with simple examples. These questions will help you to answer basic questions to deal with MS Access VBA Programming/Development.

PREMIUM TEMPLATES LIMITED TIME OFFER

ON SALE80% OFF

50+ Project Management Templates Pack
Excel PowerPoint Word

Advanced Project Plan & Portfolio Template
Excel Template

Business Presentations Templates Pack
PowerPoint Slides

20+ Excel Project Management Pack
Excel Templates

20+ PowerPoint Project Management Pack
PowerPoint Templates

10+ MS Word Project Management Pack
Word Templates


Here is the following VBA procedure to create table in the required database using VBA.

'Create table in the required database using VBA
Sub sbCreate_Table()
Dim DBase As Database
'
'Open Databse
Set DBase = OpenDatabase("C:\Users\PNRao\Documents\MyDatabase.accdb")
' Create a table with three fields.
DBase.Execute "CREATE TABLE MyTable " _
& "(EName CHAR, ENumber INT, Elocation CHAR);"
DBase.Close
End Sub
Here is the following VBA procedure to delete table from a specific database using VBA.

'Delete table from a specific database using VBA
Sub sbDelete_Table()
Dim DBase As Database
'
'Open Databse
Set DBase = OpenDatabase("C:\Users\PNRao\Documents\MyDatabase.accdb")
' Create a table with three fields.
DBase.Execute "DROP TABLE MyTable;"
DBase.Close
End Sub
Here is the following VBA procedure to the access database table using VBA.

'Add or Insert records to the access database table using VBA
Sub sbAdd_Records_Table()
Dim DBase As Database
Dim strSQL As String
'
'Open Databse
Set DBase = OpenDatabase("C:\Users\PNRao\Documents\MyDatabase.accdb")
strSQL = "INSERT INTO MyTable values('John2',12345,'U.S');"
' Adding records the table
DoCmd.RunSQL strSQL
DBase.Close
End Sub
Here is the following VBA procedure to update records in the access database table using VBA.

'Update records in the access database table using VBA
Sub sbUpdate_Records_Table()
Dim DBase As Database
Dim strSQL As String
'
'Open Databse
Set DBase = OpenDatabase("C:\Users\PNRao\Documents\MyDatabase.accdb")
strSQL = "Update MyTable set Elocation='U.K' where ENumber=12345;"
' Updating records the table
DoCmd.RunSQL strSQL
DBase.Close
End Sub
Here is the following VBA procedure to delete records in the access database table using VBA.

'Delete records in the access database table using VBA
Sub sbDelete_Records_Table()
Dim DBase As Database
Dim strSQL As String
'
'Open Databse
Set DBase = OpenDatabase("C:\Users\PNRao\Documents\MyDatabase.accdb")
strSQL = "Delete from MyTable where ENumber=12345;"
' Deleting records the table
DoCmd.RunSQL strSQL
DBase.Close
End Sub
Here is the following VBA procedure to alter (Add Column) table in the access database using VBA.

'Alter table in the access database using VBA
Sub sbAlter_Records_Table_AddColumn()
Dim DBase As Database
Dim strSQL As String
'
'Open Databse
Set DBase = OpenDatabase("C:\Users\PNRao\Documents\MyDatabase.accdb")
strSQL = "ALTER table MyTable ADD COLUMN ESal Money;"
' Alter table
DoCmd.RunSQL strSQL
DBase.Close
End Sub
Here is the following VBA procedure to alter (Delete Column) table in the access database using VBA.

'Alter table in the access database using VBA
Sub sbAlter_Records_Table_DeleteColumn()
Dim DBase As Database
Dim strSQL As String
'
'Open Databse
Set DBase = OpenDatabase("C:\Users\PNRao\Documents\MyDatabase.accdb")
strSQL = "ALTER table MyTable DROP COLUMN ESal;"
' Alter table
DoCmd.RunSQL strSQL
DBase.Close
End Sub
Here is the following VBA procedure to alter (Delete Column) table in the access database using VBA.

'Alter table in the access database using VBA
Sub sbAlter()
Dim DBase As Database
Dim strSQL As String
'
'Open Databse
Set DBase = OpenDatabase("C:\Users\PNRao\Documents\MyDatabase.accdb")
strSQL = "ALTER table MyTable DROP COLUMN ESal;"
' Alter table
DoCmd.RunSQL strSQL
DBase.Close
End Sub
Here is the following VBA procedure to export access table to Excel using VBA.

'Export access table to Excel using VBA?
Sub sbExport_Table_Excel()
'Variable declaration
Dim strTable As String
Dim strWorkbook As String
'Change target file path
strWorkbook = "D:/MyTable.xlsx"
'Source table name
strTable = "MyTable"
'Export table to Excel
DoCmd.TransferSpreadsheet transfertype:=acExport, spreadsheettype:=acSpreadsheetTypeExcel12, _
tablename:=strTable, FileName:=strWorkbook, hasfieldnames:=True
End Sub
Here is the following VBA procedure to change existing table name in access using VBA.

'Change existing table name in access using VBA
Sub sbChange_Table_Name()
'Variable declaration
Dim strOTable As String
Dim strNTable As String
'Old Table name
strOTable = "MyTable"
'New Table Name
strNTable = "EmpTable"
'Export table to Excel
DoCmd.Rename strNTable, acTable, strOTable
End Sub
Here is the following VBA procedure to find specified data in an access table using VBA.

'Find specified data in an access table using VBA
Sub sbFindData_InTable()
'Variable declaration
Dim strData As String
'Specify Data to search
strData = "John"
'find specified data
DoCmd.FindRecord strData,, True,, True
End Sub
Here is the following VBA procedure to open an existing access table in Print View using VBA.

'Open an existing access table in Print View using VBA.
Sub sbPrintView_Table()
'Variable declaration
Dim strTable As String
'Specify table Name
strTable = "EmpTable"
'find specified data
DoCmd.OpenTable strTable, acViewPreview
End Sub
Here is the following VBA procedure to open an existing access table in design View using VBA.

'Open an existing access table in design View using VBA.
Sub sbDesignView_Table()
'Variable declaration
Dim strTable As String
'Specify table Name
strTable = "EmpTable"
'find specified data
DoCmd.OpenTable strTable, acViewDesign
End Sub
Here is the following VBA procedure to open an existing access table in normal View using VBA.

'Open an existing access table in normal View using VBA.
Sub sbNormalView_Table()
'Variable declaration
Dim strTable As String
'Specify table Name
strTable = "EmpTable"
'find specified data
DoCmd.OpenTable strTable, acViewNormal
End Sub

Here is the link for more VBA Interview Questions and Answers. These are explained for examples.
100+ VBA Interview Questions

LIMITED TIME OFFER

Related pages


conditional statements in excelexcel dashboard torrentmacro to delete blank rowshow to use iferror formula in excelexcel create workbookvlookup for dummies excel 2010check mark for excelexcel 2010 delete duplicatesvbs create text filevba average functionexcel chart macroexcel vlookup worksheetexcel vba userform tutorialdelete range vbatcs c interview questions and answers pdfopen recordset vbams excel formula tutorialdim as workbookexcel autoexec macrohow to check for duplicates exceladding macro to excelhow to merge fields in excelautosave excel 2007excel vba code examples pdfhow to program vbaexcel functions vbaexcel insert chart titlehow to get developer tab in excel 2013excel workbook saveexcel formula with example in hindiunhide column a in excel 2010excel tutorial macrosvba userform initializecountif excel examplehow to create a vlookup formula in excel 2010vba columnsas reporting tutorialunprotect an excel workbook without passwordpractice excel tests for interviewsrca templatecolumns vba excelsort vbaprogramming aptitude questions and answersworksheetfunction sumunprotect worksheetmeeting minute templates freevba code to open excel workbooksales analysis template excelinsert worksheetvba combobox add itemunlock excel sheet passwordwriting an if statement in excelfind duplicate row in excelmatch type excelvlookup a formuladim array vbavba sumifsvba file copyexcel offset vlookupexcel worksheet name in cellvba rows autofithow to enter a macro in excelexcel sheet hiddenlistbox propertiesdelete empty cells in excelworksheet functions in vbahow to draw pie chart in excel 2007construction project template excelexcel duplicate entriesunprotecting excel workbookvba upper boundvba userform unload