Problem with making fields invisible in form

Lit052

New member
Local time
Tomorrow, 00:39
Joined
May 20, 2013
Messages
5
I really need help... I have 2 tables, they have relationship via object name. Then i made forms from that tables, in first form you have entered object name and then usig combo box indicate that object type. At the second form using combo box you already can choose object name from first form. And now here is a problem how to write VBA code, if in second form i choose object name witch type (in first form combo box) is "TR" i wouldnt see some fields.

Now my code looks like that, but problem is that it understand just the last saved type in that first form it doesnt change

Private Sub Objecttype_AfterUpdate()
If Form_Pagrindine.cbotipas.Value = "TR" Then
GPIK.Visible = False
Else
GPIK.Visible = True
End If
End Sub
 
I'm not fully understanding your problem, but if your Main form and Sub form are not Linked then that is the first thing you should do, link on Object Name. 2nd, you should lock Object Name on your sub form as this can not be different than what is on your Main form. Now after that I am not sure what your problem is.
 
Thank you for your response:)

Sorry for not clear question, iam adding and example to be more clear... So there are two forms, the problem is with Outlay form, then i choose Object name
and if this Object's_name, in Objects form, Object_type is "TR", element_code (Outlay form) should be invisible. I addedd VBA code on Obcet_name at Outlay form but it doesnt work, maybe its not possible to do?
Thank you again...
 

Attachments

I believe I understand now. Take a look and see if this is what you are looking for.
 

Attachments

Hmm but it doesnt work for me... if you have time please look at my attachment now... i really need this to work, thank you
 

Attachments

  • Explain.jpg
    Explain.jpg
    93 KB · Views: 129
Maybe i dont undetstand something, but that field ("Element code") is visible in all case, doesnt matter that project name i choose..... Sorry for disturbing you so much..
 
It's probably me that is missing something. What I thought you wanted was:

If Object_type on the form Objects is "TR" then hide element_code on Outlay form.

But, from your jpg I think you are saying to hide element_code on Outlay form after Object_name is chosen and Object_type on Objects form = "TR"?
 

Attachments

Yes this is exactly that i want... And now in my data table yet is just one Object_name with type "TR" its Gtu54878, so when i choose it at Outlay form, Element_code shouldnt be visible:)
 

Users who are viewing this thread

Back
Top Bottom