Form Field will not display the string result of a drop down

atrium

Registered User.
Local time
Today, 14:17
Joined
May 13, 2014
Messages
348
I have several fields in a table that are subject to the resulting recordId that displays the string shown on the drop down. They all work as they should except one and for the life of me I can't find the reason. I have checked the property sheet for all of them and all of the properties are the same (other than the obvious) as the one that only displays the recordId not the description related to that ID

Code:
Private Sub CollStatusFld_Change()
MsgBox "The CollStatus selected is = " & Me.CollStatus
Me.CollStatusFld = DLookup("CollStatus", "CollStatus", "[CollStatusId] = " & Me.CollStatus)
End Sub

The attached files are
CollStatus001 = Properties format column
CollStatus002 = Properties Data column
CollStatus003 = Properties Event column
CollStatus004 = Properties Other column
CollStatus005 = Table Entry
CollStatus006 = Display Form
CollStatus007 =Update Form
CollStatus008 =CollStatus Table


Any suggestions would be greatly appreciated
 

Attachments

  • CollStatus001.JPG
    CollStatus001.JPG
    101 KB · Views: 84
  • CollStatus002.JPG
    CollStatus002.JPG
    29.5 KB · Views: 93
  • CollStatus003.JPG
    CollStatus003.JPG
    38.5 KB · Views: 85
  • CollStatus004.JPG
    CollStatus004.JPG
    36.4 KB · Views: 86
  • CollStatus005.JPG
    CollStatus005.JPG
    66.8 KB · Views: 87
  • CollStatus006.JPG
    CollStatus006.JPG
    29.7 KB · Views: 80
  • CollStatus007.JPG
    CollStatus007.JPG
    28.9 KB · Views: 85
  • CollStatus008.JPG
    CollStatus008.JPG
    22.3 KB · Views: 87
Why don't you provide db for analysis?
 
i think you have them in reversed order in your code?
Code:
Private Sub CollStatusFld_Change()
MsgBox "The CollStatus selected is = " & Me.CollStatus
Me.CollStatusFld = DLookup("CollStatus", "CollStatus", "[CollStatusId] = " & Me.CollStatus)
End Sub
should be...


Code:
Private Sub CollStatusFld_Change()
MsgBox "The CollStatus selected is = " & Val(Me.CollStatusFld.Text & "")
Me.CollStatus = DLookup("CollStatus", "CollStatus", "[CollStatusId] = " & Val(Me.CollStatusFld.Text & ""))
End Sub

Also, using Combobox for your field will make your coding easier.
 
After looking at your presentations and reading your description, I don't understand your problem. We usually like to see things like this: (a) what were you trying to do in general? (b) what were you doing it with? (c) what did you actually get? (d) what would you have expected to get?

I'm not seeing the problem yet. Not denying you have one... but I don't see it. If I can't see it, I can't fix it.
 
I looked at this again on a computer rather than phone.
I am confused between image 6 and 7. Are you trying to use a combo box, or just lookup a value?


Private Sub CollStatusFld_Change()
MsgBox "The CollStatus selected is = " & Me.CollStatus
Me.CollStatusFld = DLookup("CollStatus", "CollStatus", "[CollStatusId] = " & Me.CollStatus)
End Sub
In this code, I don't think you want to change the field in the change event FOR the same field.

In passing, I note you have also mis-spelled guarantor, although that won't affect the database.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom