Form Field Value not visible...

Lissa

Registered User.
Local time
Today, 07:05
Joined
Apr 27, 2007
Messages
114
Hi Everyone,
Does anyone have some ideas I could try?

I have a form that is used to enter new data. The form based of a query that uses 4 tables.
As a new record is added, I am trying to programmatically populate some fields so the user doesn't have to enter them.

I added this code into the Project field's OnClick event.

Private Sub ProjectID_Click()
Dim AddSupervisor As String

AddSupervior = DLookup("[Supervisor]", "Resource", "ResourceID = " & Forms!frmSummarizedRsrcData!ResourceID)
Me.Supervisor = AddSupervisor

End Sub


I am able to add a new record, but how can I get the value of Me.Supervisor to stay visible on the form? As soon as I enter a new record it no longer displays on the form. I got the value of the Resource field to stay visible my making its default value equal to a selected dropdown value. (I have a dialog box that allows users to select a resource from a dropdown list that will filter the contents of the form).


I'm attaching a screen shot of my form so you can get an idea of what I'm talking about...

Any suggestions are appreciated!
Thanks!
Lissa
 

Attachments

  • myExample.JPG
    myExample.JPG
    71.4 KB · Views: 121
Well for one thing you've mispelled the name of you variable in your DLookup

AddSupervior = DLookup("[Supervisor]", "Resource", "ResourceID = " & Forms!frmSummarizedRsrcData!ResourceID)
 
:o How embarrassing! You would think it would have errored out on that spelling error. Okay corrected that and now I have a null error so it's probably not finding the value.

I think I have additional problems because the record is adding blank records in my supervisor table and adding the resource to the resource table again :(
 
You would think it would have errored out on that spelling error. (
Just as an FYI for you - it won't UNLESS you set your code to be OPTION EXPLICIT, which means that you must declare your variables before using them. That way, if you spell something wrong it won't just create that new variable it will tell you that this variable doesn't exist.
 
Thanks Bob.
I'm calling it quits for today... I have wasted 2 days on this problem and I feel so frustrated. Maybe I'll have better luck tomorrow :(
 

Users who are viewing this thread

Back
Top Bottom