Database Form Query

mogul0212 said:
What don't you see?

I do not see the forms you are refering too with that code?
 
The form I have the OnClick action with that code in it is named Search-Tooling

I belive that is where it goes. You did say a module, but my newbie side know very little about the difference between putting the code in a module or having a "OnClick" event button.
 
mogul0212 said:
The form I have the OnClick action with that code in it is named Search-Tooling

I belive that is where it goes. You did say a module, but my newbie side know very little about the difference between putting the code in a module or having a "OnClick" event button.

\what is the name of the form, I do not see a form with a button to have a cilck even, other than adding new records. I;ve a headache today, so I am not really thinking clearly.

You've caught me having female moments deary, so for that I apologize. I'm trying really I am.
 
Hey, you're helping me out. I'll never complain when I'm getting help. Besides, my newbie questions are probably a cause of your headache.

Search-Tooling is the name of the form that has "refresh", "run maco" and "view form" button on it. The "refresh" and "run macro" buttons were just to make testing results easier for me originally. I had them made when I noticed I couldn't leave one of the above drop down menus blank. The "view form" button was an attempt to try take the code you gave me and get results in a form, granted, I'm clueless on all this so I'm sure I don't have it done right.

Ideally, want a button to refresh the data in the query and then a button to open a form that displays the results of that search while allowing some of the criteria in the Search-Tooling form to be blank. And if they are left blank it doesn't return all records in the table, but treats that blank criteria box as a "boolean" type search saying that any item in that field is ok for search criteria. Does that make sense?
 
mogul0212 said:
Hey, you're helping me out. I'll never complain when I'm getting help. Besides, my newbie questions are probably a cause of your headache.

Search-Tooling is the name of the form that has "refresh", "run maco" and "view form" button on it. The "refresh" and "run macro" buttons were just to make testing results easier for me originally. I had them made when I noticed I couldn't leave one of the above drop down menus blank. The "view form" button was an attempt to try take the code you gave me and get results in a form, granted, I'm clueless on all this so I'm sure I don't have it done right.

Ideally, want a button to refresh the data in the query and then a button to open a form that displays the results of that search while allowing some of the criteria in the Search-Tooling form to be blank. And if they are left blank it doesn't return all records in the table, but treats that blank criteria box as a "boolean" type search saying that any item in that field is ok for search criteria. Does that make sense?

In the zip file I didn't see that form name at all, and all the forms you ahve there I didn't see one with any view form button.

However that code I gave you is to pull a report, I am sure it can be converted to work for a form too.
 
Here you go, I compacted it to get rid of junk and get down to a much smaller size.

Sorry for any confusion. I'm not quite sure why that old file was in there.
 

Attachments

Sorry took so long to get that posted. This site must have been having network issues. I couldn't get a page to connect to for forever.

Please take a look at that new zip file and see what I'm doing wrong.

Thanks again for your patience.
 
Ok, I got it to stop giving that error message, however I am stuck on how to make it populate the form.

The code was orginially made to add criteria to a report.

Here is the code below, however I can't get it to populate the boxes with the data.

In order to get some of it working you need to properly name the combo boxes in your form. that was the problem. the names didn't match what I had in the code.

If you change the names of those combo boxes to the names i have in red it will work, but I can't it to populate the form. I've got you somewhat there. The filter works fine, it just won't populate.


you can cahnge the names in your form and copy and paste this in, the filter will work. Now only to get it to populate.

I'll have to call in reinforcments for that. Sorry honey I can't do more.

Code:
Private Sub Command15_Click()

    Dim strFilter As String
    Dim strFormName As String

strFormName = "result-Tooling"

    If IsNull([COLOR="Red"]Me.cmbNCTool.Value[/COLOR]) = False Then
        strFilter = strFilter & _
            "[result-Tooling]![txtTool].Value = " & [COLOR="red"]Me.cmbNCTool[/COLOR].Value
    End If
    
    If IsNull([COLOR="red"]Me.cmbNCDivision.Value[/COLOR]) = False Then
        
        If IsNull([COLOR="red"]Me.cmbNCTool.Value[/COLOR]) = False Then
            
            strFilter = strFilter & " And "
            
        End If
                    
        strFilter = strFilter & _
            "txtNCDivision.value = '" & [COLOR="red"]Me.cmbNCDivision[/COLOR].Value & "'"
        
    End If
  
    
    If IsNull([COLOR="red"]Me.cmbToolMaterial.Value[/COLOR]) = False Then
        
        If IsNull([COLOR="red"]Me.cmbNCTool.Value[/COLOR]) = False Or _
            IsNull([COLOR="red"]Me.cmbNCDivision.Value[/COLOR]) = False Then
            
            strFilter = strFilter & " And "
        
        End If
        
        strFilter = strFilter & _
            "txtToolMaterial.value = '" & Me.[COLOR="red"]cmbToolMaterial.Value [/COLOR]& "'"
        
    End If

DoCmd.OpenForm strFormName, , , strFilter




End Sub
 
Heck, You've helped me do so much already. NO need to apologize.

You know someone that can help to populate to a form? Or do I need to try posting another thread asking how?
 
mogul0212 said:
Heck, You've helped me do so much already. NO need to apologize.

You know someone that can help to populate to a form? Or do I need to try posting another thread asking how?

I'm working on pointing people in this direction.

However we at least have the filter working. Just need to get it to populate.

So go head and get all the filtering code working, like properly naming the combo boxes in your form etc. So that when we can get someone to help you'll be read.

Yup, I'm bossy to eh...*giggles*
 
Quick question...

Do I change the name of the field in just the form, or do Ineed to change the name of the field in the original table?
 
I've tried changing the name of the fields to remove the space, but I still get the error message...

Compile error:
Method of data member not found
 
mogul0212 said:
Quick question...

Do I change the name of the field in just the form, or do Ineed to change the name of the field in the original table?


Change the name of the object in your form.

example
cmbNCTool--that should be the name of the combo box for the NC Tool #

In properties change the Name.


cmbNCDivision --> For the combo box for the NC Division combo box
cmbToolMaterial -- > For the combo box for the Tool Material box.
 
Did you cut and paste the code as I gave it to you?

If you change the name of the combo boxes in your filter form, the code will work.
 
Yup, I copied and pasted what you had posted.

Just trying to change the combo box name in properties, (the very top entry in the properties dialog box)
 
mogul0212 said:
Yup, I copied and pasted what you had posted.

Just trying to change the combo box name in properties, (the very top entry in the properties dialog box)

Yes it says name.
 
nevermind, I didn't have "cmb" in the name field of the combo box properties...

is the cmb necessary to have in the code, so I could take it out of the code and the name of the combo box?
 
ok, I get a prompt now when I hit the "view form" button...

one step closer...
 

Users who are viewing this thread

Back
Top Bottom