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.
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"