I really need help with this code. I have made a pretty complicated subform that automatically updates filter criteria based off of inputs in various fields within the search form.
What I need to do is design a command button that will kick out the information that is stored in the subform to an excel document. Ideally I would like to use the DoCmd.OutputTo function so that the user could choose their output type, but right now I'll take whatever I can get.
The code for my form is as follows. I use setlink to set the child and master relationships between the form and subform. The control source for my subform is a table named Master Table subform4. And the Record Source for the main search form is a form named SearchFormTable .
............I repeat the above code over and over for each of the over 60 different search controls within the form......
Here is the code that activate the filtering. Again, it is repeated for each of the items.
[code]Private Sub ADOBE_ELEMENTS_ AfterUpdate()
setlink
End Sub
Private Sub BARTENDER_After Update()
setlink
End Sub
Private Sub BUILD_A_BADGE_A fterUpdate()
setlink
End Sub............ ...[code]
Here is my current code for exporting. This is probably the worst written of my attempts, but I got desperate.
I'm not sure the best route to tackle this. OutputTo will only work with a Form, Table, or Query. Maybe if there is a way to store my subform into a temporary table and OutputTO that. I'm just spit balling here. If anyone can help with this I would really use it. Again, like I said, I know its a challenge, but I like the way the form autocorrects after each change without using a command button to filter. Please help
What I need to do is design a command button that will kick out the information that is stored in the subform to an excel document. Ideally I would like to use the DoCmd.OutputTo function so that the user could choose their output type, but right now I'll take whatever I can get.
The code for my form is as follows. I use setlink to set the child and master relationships between the form and subform. The control source for my subform is a table named Master Table subform4. And the Record Source for the main search form is a form named SearchFormTable .
Code:
Private Sub setlink()
Dim link As String
Dim found As Boolean
If Len(Form.Controls("Location").Value) <> 0 Then
If found Then link = link + ";"
link = link + "Location"
found = True
End If
If Len(Model.Value) <> 0 Then
If found Then link = link + ";"
link = link + "Model"
found = True
End If
Code:
If Form.Controls("PARTS BIN").Value Then
If found Then link = link + ";"
link = link + "PARTS BIN"
found = True
End If
If Form.Controls("JJ KELLER").Value Then
If found Then link = link + ";"
link = link + "JJ KELLER"
found = True
End If
searchsub.LinkMasterFields = ""
searchsub.LinkChildFields = ""
searchsub.LinkChildFields = link
searchsub.LinkMasterFields = link
End Sub
[code]Private Sub ADOBE_ELEMENTS_ AfterUpdate()
setlink
End Sub
Private Sub BARTENDER_After Update()
setlink
End Sub
Private Sub BUILD_A_BADGE_A fterUpdate()
setlink
End Sub............ ...[code]
Here is my current code for exporting. This is probably the worst written of my attempts, but I got desperate.
Code:
Private Sub Export_Click() Dim stdocname As String stdocname = "searchsub" DoCmd.OutputTo acForm, stdocname End Sub
I'm not sure the best route to tackle this. OutputTo will only work with a Form, Table, or Query. Maybe if there is a way to store my subform into a temporary table and OutputTO that. I'm just spit balling here. If anyone can help with this I would really use it. Again, like I said, I know its a challenge, but I like the way the form autocorrects after each change without using a command button to filter. Please help
Comment