A
Aliennation2002
Hi I want to be able to create an input screen to add new records and test
for duplicates before saving.
I created an entry screen with unbound text windows. Software and version
txt windows will be saved into a single field called Strsoftwarewithversion.
I need to be able to test the result of Strsoftwarewithversion and if it
finds anthing a message will warn that I have a duplicate record, then it
will clear the two fields ready for me to try again.
This is what I have so done so far.
Option Compare Database
Private Sub SoftwareWithVersion_LostFocus()
End Sub
Private Sub Command12_Click()
End Sub
Private Sub BtnSave_Click()
Dim db As Database
Dim rst As Recordset
Dim Strsoftwarewithversion As String
Set db = CurrentDb
Set rst = db.OpenRecordset("IssueLog")
Strsoftwarewithversion = Me.SoftwareTxt + " " + Me.VerTxt
With rst
.AddNew
!SoftwareWithVersion = Strsoftwarewithversion
!TypeOfIssue = Me.TypeofIssueTxt
!DateRaised = Me.DateRaisedTxt
!RaisedBy = Me.RaisedByTxt
.Update
Me.SoftwareTxt.Value = ""
Me.VerTxt.Value = ""
Me.TypeofIssueTxt = ""
Me.DateRaisedTxt = ""
Me.RaisedByTxt = ""
End With
rst.Close
End Sub
Private Sub Form_Open(Cancel As Integer)
End Sub
Private Sub VerTxt_LostFocus()
Dim Strsoftwarewithversion As String
Strsoftwarewithversion = Me.SoftwareTxt + " " + Me.VerTxt
End Sub
for duplicates before saving.
I created an entry screen with unbound text windows. Software and version
txt windows will be saved into a single field called Strsoftwarewithversion.
I need to be able to test the result of Strsoftwarewithversion and if it
finds anthing a message will warn that I have a duplicate record, then it
will clear the two fields ready for me to try again.
This is what I have so done so far.
Option Compare Database
Private Sub SoftwareWithVersion_LostFocus()
End Sub
Private Sub Command12_Click()
End Sub
Private Sub BtnSave_Click()
Dim db As Database
Dim rst As Recordset
Dim Strsoftwarewithversion As String
Set db = CurrentDb
Set rst = db.OpenRecordset("IssueLog")
Strsoftwarewithversion = Me.SoftwareTxt + " " + Me.VerTxt
With rst
.AddNew
!SoftwareWithVersion = Strsoftwarewithversion
!TypeOfIssue = Me.TypeofIssueTxt
!DateRaised = Me.DateRaisedTxt
!RaisedBy = Me.RaisedByTxt
.Update
Me.SoftwareTxt.Value = ""
Me.VerTxt.Value = ""
Me.TypeofIssueTxt = ""
Me.DateRaisedTxt = ""
Me.RaisedByTxt = ""
End With
rst.Close
End Sub
Private Sub Form_Open(Cancel As Integer)
End Sub
Private Sub VerTxt_LostFocus()
Dim Strsoftwarewithversion As String
Strsoftwarewithversion = Me.SoftwareTxt + " " + Me.VerTxt
End Sub