Cosmonaut_99
Registered User.
- Local time
- Today, 22:36
- Joined
- Oct 24, 2012
- Messages
- 15
Hi,
I have a table called "CRP_Match_Master", where one of the fields called "861_Reference" contains some null entries. I want to use VBA to display the table records on a form, where "861_Reference" has Null entries.
I have tried to achieve this using a DAO recordset, where the recordset criteria is based on IsNull. However, I'm having problems referring field "861_Reference" into the recordset - due to syntax issues, which I can't figure out.
(I'm also not sure whether I can actually use IfNull to create a criterion.)
If anybody could offer any pointers, that would be great.
Cheers.
C_99
======================================================
Private Sub Form_Open()
Dim dbs As DAO.Database
Set dbs = CurrentDb
Dim CRPMatchMaster As TableDef
Set CRPMatchMaster = CurrentDb.TableDefs("CRP_Match_Master")
Dim CRPMatch As DAO.Recordset
Dim CRPMatchFiltered As DAO.Recordset
CRP_Match_Master.Fields ("861_Reference")
Dim 861_Reference As DAO.Field
Set CRPMatch = dbs.OpenRecordset("SELECT * FROM CRP_Match_Master WHERE ((IfNull(861_Reference)) = True) ")
Set CRPMatchFiltered = CRPMatch.OpenRecordset
Do While Not CRPMatchFiltered.EOF
CRPMatchFiltered.Edit
CRPMatchFiltered.Update
CRPMatchFiltered.MoveNext
Loop
Exit Do
CRPMatch.MoveNext
Loop
CRPMatchFiltered.Close
CRPMatch.Close
Set CRPMatchFiltered = Nothing
Set CRPMatch = Nothing
End Sub
I have a table called "CRP_Match_Master", where one of the fields called "861_Reference" contains some null entries. I want to use VBA to display the table records on a form, where "861_Reference" has Null entries.
I have tried to achieve this using a DAO recordset, where the recordset criteria is based on IsNull. However, I'm having problems referring field "861_Reference" into the recordset - due to syntax issues, which I can't figure out.
(I'm also not sure whether I can actually use IfNull to create a criterion.)
If anybody could offer any pointers, that would be great.
Cheers.
C_99
======================================================
Private Sub Form_Open()
Dim dbs As DAO.Database
Set dbs = CurrentDb
Dim CRPMatchMaster As TableDef
Set CRPMatchMaster = CurrentDb.TableDefs("CRP_Match_Master")
Dim CRPMatch As DAO.Recordset
Dim CRPMatchFiltered As DAO.Recordset
CRP_Match_Master.Fields ("861_Reference")
Dim 861_Reference As DAO.Field
Set CRPMatch = dbs.OpenRecordset("SELECT * FROM CRP_Match_Master WHERE ((IfNull(861_Reference)) = True) ")
Set CRPMatchFiltered = CRPMatch.OpenRecordset
Do While Not CRPMatchFiltered.EOF
CRPMatchFiltered.Edit
CRPMatchFiltered.Update
CRPMatchFiltered.MoveNext
Loop
Exit Do
CRPMatch.MoveNext
Loop
CRPMatchFiltered.Close
CRPMatch.Close
Set CRPMatchFiltered = Nothing
Set CRPMatch = Nothing
End Sub