Manually adding data to a autopopulating text box

Kuleesha

Member
Local time
Today, 21:19
Joined
Jul 18, 2021
Messages
50
I have an bound textbox which is set up to autopopulate with data depending on entries in other parts of the same / other forms.

Its coding is as follows:
Code:
txtProblemList = DLookup("Diagnosis", "qryDiagnosis", "PatientID=" & [Forms]![frmPatient]![PatientID]) & " " & Me.txtPastMxHx & " " & Me.txtPastSxHx
txtProblemList = Trim(txtProblemList)

I want to be able to enter new data also into the textbox so that it is saved in the table. Although the data is initially saved, upon exit from the form the manually entered data gets erased and only the auto entered data stays.
Any ideas for a solution?
Thanks
 
you need only to "auto-fill" txtProblemList when it is "blank"?
Code:
If Len(Me!txtProblemList & "") < 1 then
    txtProblemList = DLookup("Diagnosis", "qryDiagnosis", "PatientID=" & [Forms]![frmPatient]![PatientID]) & " " & Me.txtPastMxHx & " " & Me.txtPastSxHx
    txtProblemList = Trim(txtProblemList)
End If
 
you need only to "auto-fill" txtProblemList when it is "blank"?
Code:
If Len(Me!txtProblemList & "") < 1 then
    txtProblemList = DLookup("Diagnosis", "qryDiagnosis", "PatientID=" & [Forms]![frmPatient]![PatientID]) & " " & Me.txtPastMxHx & " " & Me.txtPastSxHx
    txtProblemList = Trim(txtProblemList)
End If
It needs to autofill even when the field has some manually entered text so that autofill text is added to the manual text.
Is this possible?
 
Why not have a control for 'additional' text and then just append?
 
you just Append the auto-text part?

txtProblemList = (txtProblemList + ";") & DLookup("Diagnosis", "qryDiagnosis", "PatientID=" & [Forms]![frmPatient]![PatientID]) & " " & Me.txtPastMxHx & " " & Me.txtPastSxHx
txtProblemList = Trim(txtProblemList)
 
you just Append the auto-text part?

txtProblemList = (txtProblemList + ";") & DLookup("Diagnosis", "qryDiagnosis", "PatientID=" & [Forms]![frmPatient]![PatientID]) & " " & Me.txtPastMxHx & " " & Me.txtPastSxHx
txtProblemList = Trim(txtProblemList)
Now the O/P is going to say 'No I want the extra text at the end, not the beginning' :)
 
Now the O/P is going to say 'No I want the extra text at the end, not the beginning'
i believe too, but i was thinking this may be a History of some sort.
so whatever the OP type there is the Latest info, so it should be in
the beginning.:)
 
you just Append the auto-text part?

txtProblemList = (txtProblemList + ";") & DLookup("Diagnosis", "qryDiagnosis", "PatientID=" & [Forms]![frmPatient]![PatientID]) & " " & Me.txtPastMxHx & " " & Me.txtPastSxHx
txtProblemList = Trim(txtProblemList)
I tried this earlier u think but then each time the query is updated the manual text tended to get duplicated. I'm not sure will check again.
I tried without parentheses- would that make a difference ?
And no I don't mind about the order the things are displayed 🙂
 
I tried this earlier u think but then each time the query is updated the manual text tended to get duplicated. I'm not sure will check again.
I tried without parentheses- would that make a difference ?
And no I don't mind about the order the things are displayed 🙂
You are not giving the full picture. :(

Please explain ALL the steps for use of this auto fill value.

I still think a simple extra control is the easiest way to handle this. Only add if something is in the extra control?
 
tried this earlier u think but then each time the query is updated the manual text tended to get duplicated.
That is EXACTLY what happens when you concatenate an existing string with something else. As Gasman suggested, we are not mind-readers. Please explain your problem and be sure to include why sometimes you want to concatenate a value and sometimes you don't.

In general, concatenating multiple values in a single field is poor practice since it violates first normal form.
 
Thanks guys. I ended up using an extra control as Gasman suggested.
 

Users who are viewing this thread

Back
Top Bottom