Can I control what is displayed in subform?

erislover

New member
Local time
Today, 18:42
Joined
Mar 29, 2002
Messages
8
I need to create a database with information on different instruments. Each instrument will have some common information as one table, logically enough, with information like owner, user, company, et cetera. However, instruments will also have specific information that apply only to their type, like which upgrades/modifications they have and such.

I had planned to make one huge table that has all the information on specific instruments, and hope that the form can tell the subform which information to display and which not to... it seems completely possible, yet I have no idea where to begin.

To be, perhaps, a little more clear on what will be in the form which I wish to selectively display, consider that we sell, hypothertically, three instruments, and inst1 has module1, mod2, mod3, while inst2 has item1, item2, item3, and so forth, so when the main form would pick an inst1, the subform would only display the relevant data from the jumbo table. (hope that was clearer)
 
Ok, I am finally to the point where I know exactly what I need and I hope it can be done.

I will have a form that will need a button on it. The button will open another modal dialog form. BUT... which form it actually opens will need to depend on a record in the form that the actual control is on. that make sense?

That is what I need. And the question is: can access do it?
 
If you're talking about opening a form to the same record as your current form, look up the help topic, "Synchronize records between two forms."

If you want to select a form to open based on the type of record currently up, look into the Switch() function.
 
Last edited:
It is definitely the latter, but unfortunately i don't know how to use VB at all.
 
Alright, can you give a couple examples of actions you want to do then? I can provide you with code that will almost work, you'll just have to possibly change some field names and add a few more options to the list...
 
I appreciate the offer for help very much, but in the two days that this board has been down I went in and taught myself some VB! For reference, here's how I handled the situation.
Code:
Private Sub ViewInstForm_Click()
'Handle button click by
'checking "instrument type" and then
'opening the correct form
Dim str_InstrType As String
strInstType = Me!InstrumentType
Dim strInstSerNum As String
strInstSerNum = Me!InstrumentSerialNumber
If IsNull(strInstType) Then
    strInstType = "No Type Defined"
End If

Select Case strInstType

    Dim Msg, Style, Title, Response
    
    Case "No Type Defined"
        Msg = strInstType    ' Define message.
        Style = vbOKOnly + vbCritical + vbDefaultButton2    ' Define buttons.
        Title = "Error"    ' Define title.

        Response = MsgBox(Msg, Style, Title)
    Case "pSOL"
      ' Specific case handlers
    Case "PSR4"
      ' Specific case handlers
    Case "SGA"
      ' Specific case handlers
    Case "GLpKa"
      ' Specific case handlers
    Case "PCA101"
      ' Specific case handlers
    Case "PCA200"
      ' Specific case handlers
    Case "DPAS"
      ' Specific case handlers
    Case Else
        Msg = "Invalid instrument Type"    ' Define message.
        Style = vbOKOnly + vbCritical + vbDefaultButton2    ' Define buttons.
        Title = "Error"    ' Define title.
        
        Response = MsgBox(Msg, Style, Title)
End Select

End Sub
Well, it isn't quite done. I need to put a null test in for instrument serial number, but otherwise it is up and running.

Now if I could just figure out why my underlying query has data but the form won't show it... (but that's another thread)
 

Users who are viewing this thread

Back
Top Bottom