VBA Access CurrentDB and Connection DB - learnit

Home Top Ad

Post Top Ad

Sunday, July 11, 2021

VBA Access CurrentDB and Connection DB

VBA Access CurrentDB and Connection DB

VBA Access CurrentDB and Connection DB

VBA is an abbreviation for Visual Basic for Applications (the application is, of course, Microsoft Access), and it refers to the technology and tools used to program and automate this application.



It is used not only within the framework of Microsoft Access Database, but also in other applications such as Microsoft Excel, Microsoft Word, and Microsoft Outlook, to name a few. It has the ability to communicate with applications outside of the Microsoft range, as well as the Microsoft Windows operating system on other platforms. As a result, learning the fundamentals of VBA with Access as the tool environment.


1.Manage smaller re-usable procedures (globally).

2.Create you own defined functions.

3.Hold variables in memory (globally).

4.Attach code to an event i.e. a button on a form.

5.Manage more powerful procedures that an Access macro lacks.

6.Communicate with other applications and platforms.

7.Gracefully handle errors (when they happen).


Microsoft Access is an information management program that allows you to save data for future reference, reporting, and analysis. Microsoft Access is a database application that allows you to analyze large amounts of data and manage related data more efficiently than Microsoft Excel or other spreadsheet applications.


The CurrentDb() Function

Access maintains a single permanent reference to the current database at all times. At startup, the first member of the Databases collection is populated with a reference to the current database. Microsoft devised a solution in the form of the CurrentDb () function. CurrentDb (optional parentheses) is not an object. A built-in function returns a reference to the current user's default settings.


Example

Private​ sub Form_Load()
Set db =CurrentDb
set rs=db.OpenRecrdset("tblStudent",dbOpenDynaset, dbSeeChanges)
Do Until rs.EOF
Me.liststudentName.AddItem rs("Name")
rs.MoveNext
Loop
End Sub


Please Watching My Video is Below

No comments:

Post a Comment

Post Top Ad