Trouble with a search/update button, please help

haveli1

New member
Local time
Today, 06:51
Joined
Jul 24, 2006
Messages
9
Hope everyone is having a great day. This is my first post. I am very new at Access and Visual Basic. My boss has given me a database which he wants me to fix. I have run into a problem.

I have a form which has a button on it called "update." The user enters information such as the Status, or the Title. After clicking the button, the code should pull up the form which matches the given status, Title, or other information. The form it pulls up is linked to a table.The button was working before but for some reason it is not working now. I have the code below. It would be nice to get some help on this. I think there is something wrong with opening the form, but not sure. Thanks in advance.

H.
Code:
Private Sub update_Click()
query = "Select * from [All Data Inv Discl] Where ID >= 0"

If (Not (Me.stat.Value = "")) Then query = query & " And [Status] = '" & Me.stat & "'"

If (Not (Me.tit = "")) Then query = query & " And [Title] LIke '*" & Me.tit & "*'"
If (Not (Me.pri = "")) Then query = query & " And [Priority] = '" & Me.pri & "'"
If (Not (Me.sum = "")) Then query = query & " And [Summary] LIke '*" & Me.sum & "*'"

On Error Resume Next
                                  
    With CurrentDb
                                
    .QueryDefs.Delete ("UPDID")
    Set qdfNew = .CreateQueryDef("UPDID", query)
    .Close
    End With
    DoCmd.RunSQL query
    DoCmd.OpenForm "Invention Disclosure Input Form", , , , , , "UpdateT"
 

Users who are viewing this thread

Back
Top Bottom