R
ryguy7272
Learning the ins and outs of Access is a humbling experience.
Anyway, I thought I would update some unbound TextBoxes on a few Forms using
Dlookup. That method seemed to work well. Sometimes I need to simply view
the contents of a Field in a Table, named ‘PatientTable’ and in these cases
the Dlookup works fine.
To view the data in the Field, I am using a method such as this:
=DLookUp("[SIM_Comments]","[PatientTable]","[MR] = " & [MR])
However, sometimes I have to view the contents of this field, and sometimes
I have to add to the Field; I need read a write access to the Table. What is
the easiest way to do this? The DLookUp() seems to prevent me from writing
back to the Table.
I have been trying to load the appropriate variables from the Field with
this code:
Private Sub Command20_Click()
Me.Form.RecordSource = "SELECT * FROM SimQuery " & BuildFilterSim
Me.SimForm.Requery
End Sub
Private Function BuildFilterSim() As Variant
Dim varWhere As Variant
Dim varItem As Variant
Dim intIndex As Integer
varWhere = Null ' Main filter
' Check for LIKE First Name
If Me.MR > "" Then
varWhere = varWhere & "[MR] LIKE """ & Me.MR & "*"" AND "
End If
' Check if there is a filter to return...
If IsNull(varWhere) Then
varWhere = ""
End If
BuildFilter = varWhere
End Function
The Field named ‘MR’ is a uniqe ID number and I believe could be looked up
according to this. Is this approach correct? How can I get this working?
Thanks,
Ryan----
Anyway, I thought I would update some unbound TextBoxes on a few Forms using
Dlookup. That method seemed to work well. Sometimes I need to simply view
the contents of a Field in a Table, named ‘PatientTable’ and in these cases
the Dlookup works fine.
To view the data in the Field, I am using a method such as this:
=DLookUp("[SIM_Comments]","[PatientTable]","[MR] = " & [MR])
However, sometimes I have to view the contents of this field, and sometimes
I have to add to the Field; I need read a write access to the Table. What is
the easiest way to do this? The DLookUp() seems to prevent me from writing
back to the Table.
I have been trying to load the appropriate variables from the Field with
this code:
Private Sub Command20_Click()
Me.Form.RecordSource = "SELECT * FROM SimQuery " & BuildFilterSim
Me.SimForm.Requery
End Sub
Private Function BuildFilterSim() As Variant
Dim varWhere As Variant
Dim varItem As Variant
Dim intIndex As Integer
varWhere = Null ' Main filter
' Check for LIKE First Name
If Me.MR > "" Then
varWhere = varWhere & "[MR] LIKE """ & Me.MR & "*"" AND "
End If
' Check if there is a filter to return...
If IsNull(varWhere) Then
varWhere = ""
End If
BuildFilter = varWhere
End Function
The Field named ‘MR’ is a uniqe ID number and I believe could be looked up
according to this. Is this approach correct? How can I get this working?
Thanks,
Ryan----