search
HomeTopicsAccessWhat is the method of calling custom function in access query?

What is the method of calling custom function in access query?

You can directly call custom functions in Access queries, which can help us solve some special query statistics in actual work.

(Related recommendations: access database learning)

Example:

Q: How to count the number of times certain words appear in lyrics?

Step 1: Create a table

See the figure below for the specific table

What is the method of calling custom function in access query?

##Step 2: Write a custom function

The specific functions are as follows. There is a knowledge point here, which is the Split function. We will talk about this later, but I will mention it here first.

[code=vb]
Public Function WordFrequency(ByVal Lyric As String, ByVal Word As String) As String
Dim arr As Variant
Dim brr As Variant
Dim i As Long
Dim countChar As Long
If Lyric = “” Or Word = “” Then Exit Function
If InStrRev(Word, “|”) = 0 Then Exit Function
arr = Split(Word, “|”)
For i = 0 To UBound(arr) - 1
brr = Split(Lyric, arr(i))
countChar = UBound(brr) - LBound(brr)
WordFrequency = WordFrequency & ““” & arr(i) & “”” & “出现次数:” & countChar & vbCrLf
Next i
End Function
[/code]

Step 3: Build a query

For specific queries, let’s look at the screenshot below

What is the method of calling custom function in access query?

SQL statement:

SELECT song title, lyrics, word segmentation, WordFrequency([lyrics],[word segmentation]) AS word frequency FROM Table 2;

Finally, let’s take a look at the running results

What is the method of calling custom function in access query?

The above is the detailed content of What is the method of calling custom function in access query?. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:csdn. If there is any infringement, please contact admin@php.cn delete

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment