Full Version: Changing Linkedfield values
UtterAccess Forums > Microsoft® Access > Access Forms
JVanKirk
Good afternoon everyone. Have a question. I am using the following code to set the sourceobject of an unbound subform:
Private Sub imgMyTicketsOver_Click()
Me.Subform.SourceObject = "sfrmQuickTickets"
Me.Subform.LinkChildFields = "WorkPerformedBy"
Me.Subform.LinkMasterFields = "EmployeeID"
Me.imgMyTicketsOver.Visible = False
Me.AddLogEntry.Visible = False
End Sub
I am doing this because I use the same subform to display differant subforms and this is cleaner than hiding and showing differant subs. The problem is when I go from this one to the click event of another button:
Private Sub imgTaskingsOver_Click()
On Error GoTo Err_imgTaskingsOver_Click
Me.Subform.SourceObject = "sfrmQuickTaskings"
Me.AddLogEntry.Visible = False
Exit_imgTaskingsOver_Click:
Exit Sub
Err_imgTaskingsOver_Click:
MsgBox Err.Description
Resume Exit_imgTaskingsOver_Click

End Sub
When I click this button it prompts me for WorkPerformedBy because of the LinkFields in the other code. How do I Null the values for the LinkChild and Master fields? I tried setting them to zero strings(="") and I get the same prompt and then another error. If I try (= Null) I get an invalid use of Null. I am about to revert back to hiding and showing subforms!! I don't know what else to try.
Thanks in advance for any ideas.
Jason
P.S. Jack C. If you're out there I used the SourceObject idea from another of your posts and really like this method. I run into problems though when messing around with the link fields.
One more, is there a way to set the Record Source property of the subform using an unbound subform like I am and setting the SourceObject? If so I can possibly circumvent te use of the LinkFields by using some SQL as the recordsource of the subform.
Again THANK YOU!!!
Jason
Jack Cowley
Jason -
I am finally here. Tuesday mornings are my mornings to work at the library...
This should work:
Me.Subform.LinkChildFields = ""
Me.Subform.LinkMasterFields = ""
The SourceObject is the actual form you want to use but if you want to use a single form and change the RecordSource you can do that with:
Me.Subform.Form.RecordSource = "YourQueryOrYourTableName"
I did I answer your question or did I miss something in my haste?
Jack
JVanKirk
Jack,
had tried using Me.Subform.LinkChildFields = ""
That works good when I am going between differant options where the SourceObject of the subform stays the same. When I try to change the SourceObject to a new subform and then set the link fields to the above it still wants to try to find the field WorkPerformedBy specified in the VBA of another button. I am totally lost on this one. Unfortunately I am out the door for the day. I will look for your reply in the morning and give more details if need be. If I have to I'll export the necessities to a new db and zip and send to you. I really want to get this one last bit working so I can put it into play.
Jason
Jack Cowley
Jason -
o you have a link in the table that is the subform to the table in the main form that is WorkPerformedBy? I am not sure what is going on so if you want to whip up a demo of the problem I will take a look at it once I get my brain fired up, which probalby won't be until sometime after 9am your time...
Jack
JVanKirk
Jack,
et me throw together the bits you need..going to just throw the forms required in a copy of the BE and hopefully it will be under the allowable size.
Jason
JVanKirk
Jack, here it is, I think the limit is 500K so this should work.
little navigation...
If you go to Tickets-->View All Open, or to the View All Tickets and then to Taskings there is no issue. When you go to Tickets-->View My Tasking(the one that sets the LinkFields) then go to Taskings or Work Log, a prompt for the value of WorkPerformedBy will come up because the subform that is being opened at that point does not have the control WorkPerformedBy. WorkPerformedBy is hidden behind the Description field in the subform for Tickets. Anyway, I am sure if you get in messing around with this you'll probably figure out what is going on with it. ALSO, you may have an issue with a field that is controlled by Environ(NWUsername). Don't know if you are famliar with Novell Client but it is the username control that I use to control accesibility in the database.
Thanks for your time and help.
Jason
JVanKirk
Good morning Jack.
ither you got tied up or you're sitting looking at that doggone form scratching your head. I figured you'd have figured it out by now with what you know. If you're boggled by it it sure makes me feel better. I tried about 4 or five differant approaches to this thing and just can't getit going. I'm about ready to go back to changing visible properties for differant subforms.
Anyway, have a great day out in CA. It's foggy as heck here this AM. About 40ft visibility tops.
Jason
JVanKirk
Jack,
Here is a new attachment with the info you requested, as well I added the forms to allow you to use the details button on the records. Glad your trip to SanFran was good.
If you click on the taskings button first you will see what is supposed to come up after clicking on the My Tickets and then back to Taskings.
Thanks again for your time.
Jason
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.