Code: Select all
strSQL = "SELECT [Name],IIf(IsNull([Gender]),[Address],[DoB] FROM tblList WHERE [ID]='" & Me.txtID.Value & "'"
Any help would be kindly appreciated.
Code: Select all
strSQL = "SELECT [Name],IIf(IsNull([Gender]),[Address],[DoB] FROM tblList WHERE [ID]='" & Me.txtID.Value & "'"
Code: Select all
strSQL = "SELECT [Name],IIf(IsNull([Gender]),[Address],[DoB]) FROM tblList WHERE [ID]='" & Me.txtID.Value & "'"
Code: Select all
strSQL = "SELECT [Name],IIf([Gender] Is Null,[Address],[DoB]) FROM tblList WHERE [ID]='" & Me.txtID.Value & "'"
Code: Select all
Private Sub txtID_AfterUpdate()
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim strSQL As String
Application.ScreenUpdating = False
Application.EnableEvents = False
If Me.txtID.Value <> "" Then
Set cnn = New ADODB.Connection
cnn.Open "Provider=Microsoft.ace.OLEDB.12.0; " & _
"Data Source=D:\VA\Database.accdb;"
Set rst = New ADODB.Recordset
strSQL = "SELECT [Name],IIf([Gender] Is Null,[Address],[DoB]) FROM tblList WHERE [ID]='" & Me.txtID.Value & "'"
rst.Open Source:=strSQL, ActiveConnection:=cnn, Options:=adCmdText
Me.txtName.Value = rst![Name]
Me.txtGender.Value = rst![Gender]
Me.txtAddress.Value = rst![Address]
Me.txtDOB.Value = rst![DOB]
rst.Close
cnn.Close
Set rst = Nothing
Set cnn = Nothing
Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End Sub
Code: Select all
strSQL = "SELECT [Name],[Gender],[Address],[DoB] FROM tblList WHERE [ID]='" & Me.txtID.Value & "'"
Code: Select all
Me.txtName.Value = rst![Name]
Me.txtGender.Value = rst![Gender]
Me.txtAddress.Value = rst![Address]
Me.txtDOB.Value = rst![DOB]
Code: Select all
IIf([Gender] Is Null