Skip to main content

AccessTr.neT


İnsert Sonrası İlgili Kaydın İd Sini Almak

İnsert Sonrası İlgili Kaydın İd Sini Almak

#3
Sub AddNewX() 
   
    Dim dbsNorthwind As Database
    Dim rstEmployees As Recordset
    Dim strFirstName As String
    Dim strLastName As String
   
    Set dbsNorthwind = OpenDatabase("Northwind.mdb")
    Set rstEmployees = _
    dbsNorthwind.OpenRecordset("Employees", dbOpenDynaset)
   
    ' Get data from the user.
    strFirstName = Trim(InputBox( _
    "Enter first name:"))
    strLastName = Trim(InputBox( _
    "Enter last name:"))
   
    ' Proceed only if the user actually entered something
    ' for both the first and last names.
    If strFirstName <> "" and strLastName <> "" Then
   
    ' Call the function that adds the record.
    AddName rstEmployees, strFirstName, strLastName
   
    ' Show the newly added data.
    With rstEmployees
    Debug.Print "New record: " & !FirstName & _
    " " & !LastName
    ' Delete new record because this is a demonstration.
    .Delete
    End With
   
    Else
    Debug.Print _
    "You must input a string for first and last name!"
    End If
   
    rstEmployees.Close
    dbsNorthwind.Close
   
    End Sub
   
    Function AddName(rstTemp As Recordset, _
    strFirst As String, strLast As String)
   
    ' Adds a new record to a Recordset using the data passed
    ' by the calling procedure. The new record is then made
    ' the current record.
    With rstTemp
    .AddNew
    !FirstName = strFirst
    !LastName = strLast
    .Update
    .Bookmark = .LastModified
    End With
   
    End Function
@benbendedeilem
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da

Bu Konudaki Yorumlar
Cvp: İnsert Sonrası İlgili Kaydın İd Sini Almak - Yazar: accessman - 12/03/2020, 16:01
Cvp: Log Kaydı Oluşturmak - Yazar: berduş - 14/03/2020, 11:32
Cvp: Log Kaydı Oluşturmak - Yazar: accessman - 14/03/2020, 12:07
Cvp: Log Kaydı Oluşturmak - Yazar: berduş - 14/03/2020, 12:12
Cvp: Log Kaydı Oluşturmak - Yazar: accessman - 14/03/2020, 12:42
Cvp: Log Kaydı Oluşturmak - Yazar: berduş - 14/03/2020, 12:47
Cvp: Log Kaydı Oluşturmak - Yazar: accessman - 14/03/2020, 12:50
Cvp: Log Kaydı Oluşturmak - Yazar: feraz - 14/03/2020, 12:55
Cvp: Log Kaydı Oluşturmak - Yazar: berduş - 14/03/2020, 13:10
Cvp: Log Kaydı Oluşturmak - Yazar: accessman - 14/03/2020, 13:14
Cvp: Log Kaydı Oluşturmak - Yazar: berduş - 14/03/2020, 13:19
Cvp: Log Kaydı Oluşturmak - Yazar: berduş - 14/03/2020, 13:27
Cvp: Log Kaydı Oluşturmak - Yazar: accessman - 14/03/2020, 13:40
Cvp: Log Kaydı Oluşturmak - Yazar: feraz - 14/03/2020, 13:53
Cvp: Log Kaydı Oluşturmak - Yazar: feraz - 14/03/2020, 13:55
Cvp: Log Kaydı Oluşturmak - Yazar: berduş - 14/03/2020, 14:00
Task