Programming for Everybody: Microsoft access
Showing posts with label Microsoft access. Show all posts
Showing posts with label Microsoft access. Show all posts

🔍 Search Access Database Directly from PowerPoint! | Smart Integration Tutorial With Source code

 




Private Sub CommandButton1_Click()

If id_txt.Text <> "" Then

Dim rst As New ADODB.Recordset

Dim conn As New ADODB.Connection

Dim strsql As String

conn.ConnectionString = "Provider=Microsoft.Ace.Oledb.12.0; Data Source=H:\contents\sports.accdb" _

& " ;Persist Security info = False"

    strsql = " SELECT * FROM Table2 Where id=" & id_txt.Text & ""

conn.Open


rst.Open strsql, conn

If rst.EOF Then

MsgBox "Data Not Found"

name_txt.Text = ""

age_txt.Text = ""

sport_txt.Text = ""

points_txt.Text = ""

date_txt.Text = ""

Else

name_txt.Text = rst.Fields("name1")

age_txt.Text = rst.Fields("age")

sport_txt.Text = rst.Fields("sport")

points_txt.Text = rst.Fields("points")

date_txt.Text = rst.Fields("date_reg")

   End If

       conn.Close

       End If

End Sub


How to add new column IIF in subform with change colors cells based on its value in MS Access forms

Learn how to add a new column with IIF function in a subform and change cell colors based on values in MS Access forms. Improve your form design skills with this tutorial!Videos Access
Subscribe to Youtube
 
https://www.youtube.com/@programmingcode2025/?sub_confirmation=1


Very simple Code insert button VBA without duplicate values in MS Access VBA with source code





Source Code in video

Dim dbs As DAO.Database

Dim rst As DAO.Recordset

Dim strsql As String

Set dbs = OpenDatabase("H:\products.accdb")

Set rst = dbs.OpenRecordset("Select product From Table1 Where product = '" & Me.Text0.Value & "' ")

If rst.RecordCount > 0 Then

MsgBox ("This Product exists before")

Else

strsql = "Insert Into Table1(product)Values( '" & Me.Text0.Value & "' )"

dbs.Execute (strsql)

MsgBox ("The product inserted successfully")

End If

rst.Close

dbs.Close