Update on Click

Tanya

Access Novice
Local time
Yesterday, 21:47
Joined
Sep 7, 2008
Messages
165
Hi
I have a main form with values in subforms which I need to update other subforms by means of a click. The following code works fine with SubjectID but NOT UnitID.
there are also no error messages, just nothing happens.
Can anyone tell me if there is something wrong with the code?

Option Compare Database
Private Sub UnitDescription_Click()

Forms!frmAddComp!frmVETUnits!frmCompetency.Form!SubjectID = Forms!frmAddComp!frmVETUnits!SubjectID
Forms!frmAddComp!frmVETUnits!frmCompetency.Form!UnitID = Forms!frmAddComp!frmVETUnits!UnitID
End Sub

Kind regards
Tanya
 

Attachments

Ok, so you have two statements that you want to perform a copy.

The first statement is doing nothing because StudentID does not exist in the destination subform.

The second statement is problematic because it is a combo and you have set it to "limit to list". But the list is not working (there is no list), so nothing can be added. The reason the list is not working is because it is using a table called tblOutcomes for its source but there is no such table.

hth
Chris
 
Hi Stopher
The first statement appears to be from what I can tell. ?? I'm not sure which form you were looking at to see this?
The second statement like you said is looking at a missing table - couldn't work out how that could be, but have since rectified it.
Still, I cannot see why the second statement doesn't work?
Thanks for your feedback.
Regards
Tanya
 
In frmCompetency you have an unbound text box called txtStudent. But there is no object called StudentID.

Are you seying you haven't fixed the second statement?

Chris
 
Hi Chris
In frmCompetency there is an unbound text box called txtStudent and it is updated with the following statement which works fine:
Forms!frmAddComp!frmVETUnits!frmCompetency.Form!txtStudent = Forms!frmAddComp!subfrmAddComp.Form!Student

With the second statement I have removed the reference to tblOutcomes, however the statement still does not work.

Tanya
 
Just to make sure we're talking about the same thing, this is the line in question..

Code:
Forms!frmAddComp!frmVETUnits!frmCompetency.Form!SubjectID = Forms!frmAddComp!frmVETUnits!SubjectID

But SubjectID does not exist in the subform frmCompetency. You are trying to reference a field on this form that doesn't exist. I wondered if you may have been confused by txtStudent but that was a red herring.

Stick with Tanya, we will get there ;)

Chris
 
Hi Chris,
I appreciate your hanging in there for me.
If you look at frmCompetency in design mode, you will see that SubjectID is a field which is accessed by this form and this is working even though I have not displayed it in form view.
txtstudent is used purely so the user can identify the record i.e. studentclassID wouldn't mean anything to the user. What is strange about this problem is that I am not getting any error, it just simply doesn't update the UnitID field.
cheers
Tanya
 
Last edited:
Hi Chris,
I appreciate your hanging in there for me.
If you look at frmCompetency in design mode, you will see that SubjectID is a field which is accessed by this form and this is working even though I have not displayed it in form view.
txtstudent is used purely so the user can identify the record i.e. studentclassID wouldn't mean anything to the user.
cheers
Tanya
Hi Tanya,
I agree that StudentID is available in the underlying data source for the form but it isn't actually referenced on the form i.e. there is no control on the form called "StudentID". The line we are talking about is trying to refer to a control on the form. You need to add a control (e.g. a text box) that is bound to StudentID and call it StudentID. You can make it visible if you wish by setting its visible attribute to false.

hth
Chris
 
Hi Chris
If you look at the tblCompetencies you should see that the first statement actually works.
In this latest version, I have added a statement to update performanceID which works [this time I left it on the form so you can see that it updates the correct field]
Which brings me back to my problem with the second statement. This is very frustrating...
cheers
Tanya
 

Attachments

Hi Chris
In an interesting development, the second statement does appear to work if you look at the table tblCompetency rather than the frmCompetency. I know it is rather strange but there it is. I think it has something to do with the lookup process.
On a further note, after all this, it doesn't give me what I want. What I need is to be able to view each students comptency for a unit. My intention was to run reports from tblcompetency but that is still a little messy.
so... back to the drawing board.
cheers
Tanya
 
Hi Tanya
I will try to take a look later today but I have to work now.

When I was mantioning StudentID I actually meant SubjectID - sorry.

But I will need more time to look.

Chris
 
Hi Chris
Thank you for your support. I hope you have good day at work.
I have finally found success!!
After fixing the problem with the lost link I deleted frmCompetency and recreated it, then all worked as planned.
I am self taught so this project continues to be a steep learning curve for me.
cheers
Tanya
 

Users who are viewing this thread

Back
Top Bottom