J
Jez
Hi, If I have an Input box with this code below in, what I want to know is
that if the value that is input into this box is not in my lookup table how
can I put a message saying that this person is not in the database?
Jez
Private Sub btnCreateNewInput_Click()
Dim rs As DAO.Recordset
Dim NewID As Long
varInput = InputBox("Enter the RPSGB Reg No", "Add new Data")
If varInput = "" Then Exit Sub
Set rs = CurrentDb.OpenRecordset("SELECT * FROM tblData WHERE
False")
rs.AddNew
NewID = rs.Fields![FormNumber]
rs.Fields![RPSGBRegNo] = varInput
rs.Update
rs.Close
Dim sQRY As String
sQRY = "SELECT tblData.* FROM tblData WHERE tblData.FormNumber =
" & NewID
Set rs = CurrentDb.OpenRecordset(sQRY)
rs.Close
Set rs = Nothing
Me.RecordSource = sQRY
Me.txtDummy.SetFocus
Me.Requery
End Sub
that if the value that is input into this box is not in my lookup table how
can I put a message saying that this person is not in the database?
Jez
Private Sub btnCreateNewInput_Click()
Dim rs As DAO.Recordset
Dim NewID As Long
varInput = InputBox("Enter the RPSGB Reg No", "Add new Data")
If varInput = "" Then Exit Sub
Set rs = CurrentDb.OpenRecordset("SELECT * FROM tblData WHERE
False")
rs.AddNew
NewID = rs.Fields![FormNumber]
rs.Fields![RPSGBRegNo] = varInput
rs.Update
rs.Close
Dim sQRY As String
sQRY = "SELECT tblData.* FROM tblData WHERE tblData.FormNumber =
" & NewID
Set rs = CurrentDb.OpenRecordset(sQRY)
rs.Close
Set rs = Nothing
Me.RecordSource = sQRY
Me.txtDummy.SetFocus
Me.Requery
End Sub