Return the name of a record's source table

See attached example using a subform with a dynamic source object.
 

Attachments

I looked at your database. I don't understand your queries, they seem to be just showing records in the corresponding tables. A Report is normally printed, but as you have shown it you can use it for searching. Some restructuring could simplify your search, but if it works for you that's OK.

As I see your data and needs, from someone who does not understand the details of networks nor telephony, I see you have a Line that can be 1 of 3 different types. And each line type has specific attributes.
In database and modelling terms this would be a supertype/subtype set up.

Line is a supertype and IP, Phone and Transmission are subtypes with LineType being the discriminator. If you were redesigning your database, these facts could be useful.

However, I have just seen that Galaxiom has responded.
He made a Form/Subform set up that should handle your database. He identified LineType as an attribute of all lines so moved it to the Line table (supertype in my terms).

Anyway, good luck with your project.
 
Last edited:
Great! Combining what Galaxiom did with the code I wrote this works perfectly.

But I noticed you changed a few things as in writing a query as the source of DemoForm.

Can you please explain what you changed since I'm planning on creating a better version of the current full DB to make it work properly.

Also It'd be great if you could explain the code you wrote in VBA.
I know the DLookup function but I can't quite get it all together..

Code:
Option Compare Database
Option Explicit

Private Sub Form_Current()

Dim SubFormType As String

    SubFormType = DLookup("LineTypeName", "LineTypes", "LineTypeID=" & Me.LineTypeID)
    
    Me.SpecialAttributes.SourceObject = SubFormType
    
End Sub

I would like to know better what you did, how you changed the source of the form and all...

By the way, I get an error when trying to go past the last record:
Syntax Error (missing operator) in query expression 'LineTypID='

Can you help me fix it?

Oh and jdraw about what you asked me about VRF the answer is yes, and you don't really need to know anything about networks to help me with my issue... :)

I would like to know more about that idea of supertypes/subtypes and as I said, in general what Galaxiom did to make it all work.

Thank you both very much! :D
 
See this post where I responded re supertype/subtype.

We're always here if you need a little hint now and then.
Good luck.
 
Thanks :)
I'll look into it.

Anyway you can help me with the error I mentioned?

Syntax Error (missing operator) in query expression 'LineTypID='
 
Sorry to bother you but could you please just fix the error when you go past the last record?

Then my this post is pretty much solved...

Thanks
 

Users who are viewing this thread

Back
Top Bottom