Donkeygirl
Technical User
O.k. I have a newspaper catalog database that I am trying to create, so that we can find articales when we need them. I have the entry form all set, and now I am having trouble on the search side, which of course seems to be difficult.
The search form is being set up to allow the user to search by date, date range, articale title, and the most difficult keyword(s).
while I know how hard that will be, it is probably the most important capability to give to this search form.
For right now, I need to get the basic code working so that searching by date(s) and title work, and then I will focus in on the keyword(s) component.
Database info: 1 table with a primary key 'articaleid'
'description' field 255 length text which has a non punctuated sentence or list of buzz words:
mayor supports economic cushion for city school board to recover from deficit in budget as projects get off the ground
that is just side not info for the keyword in case someone already knows how to handle that.
Here is the big part.
On the form, I have the onclick to open a results form of articale matches to the search.
1st there is an option group to choose which search method. That enables that field on the form. Then they can fill it in appropriately. Now, If that field is null a msgbox tells them that, otherwise it opens form, based on field criteria.
My code is not right. Can anyone help me with this?
here is what I have:
Private Sub cmdsearch_Click()
If Me.optsearch = 1 And Me.txttopic = False Then DoCmd.RunMacro Mtopic
ElseIf Me.optsearch = 1 And Me.txttopic Is Not Null Then
DoCmd.OpenForm "frmresults", acNormal, , Me.txttopic = Forms![frmresults]![txtDes], acFormPropertySettings, acDialog
ElseIf Me.optsearch = 2 And Me.txtdate = False Then DoCmd.RunMacro Mdate
ElseIf Me.optsearch = 2 And Me.txtdate > 1 Then DoCmd.OpenForm "frmresults", acNormal, , Me.txtdate = Forms![frmresults]![txtADate], acFormPropertySettings, acDialog
ElseIf Me.optsearch = 3 And Me.txtdate = False Or Me.txtdates = False Then DoCmd.RunMacro Mdates
ElseIf Me.optsearch = 3 And Me.txttopic > 1 And Me.txttopic > 1 Then DoCmd.OpenForm "frmresults", acNormal, , "Forms![frmresults]![txtADate] Between '#" & Me.txtdate & "#' And '#" & Me.txtdates & "#'", acFormPropertySettings, acDialog
ElseIf Me.optsearch = 4 And Me.txttitle = False Then DoCmd.RunMacro Mtitle
ElseIf Me.optsearch = 4 And Me.txttitle = "*" Then DoCmd.OpenForm "frmresults", acNormal, , Me.txttitle = Forms![frmresults]![txtATitle], acFormPropertySettings, acDialog
Else: DoCmd.RunMacro Mnothing
End If
End Sub
___________________________
Now I was working on it this weekend, and I have it redone with dim code to declare everything at the beginning and it is probably closer to correct syntax. That can only mean one thing. I didnt bring it in from home. If I am told that this is completely wrong, I will post that code next. Please help.
Thanks in advance.
Donkeygirl,
Kickin' the crap out of Access
The search form is being set up to allow the user to search by date, date range, articale title, and the most difficult keyword(s).
while I know how hard that will be, it is probably the most important capability to give to this search form.
For right now, I need to get the basic code working so that searching by date(s) and title work, and then I will focus in on the keyword(s) component.
Database info: 1 table with a primary key 'articaleid'
'description' field 255 length text which has a non punctuated sentence or list of buzz words:
mayor supports economic cushion for city school board to recover from deficit in budget as projects get off the ground
that is just side not info for the keyword in case someone already knows how to handle that.
Here is the big part.
On the form, I have the onclick to open a results form of articale matches to the search.
1st there is an option group to choose which search method. That enables that field on the form. Then they can fill it in appropriately. Now, If that field is null a msgbox tells them that, otherwise it opens form, based on field criteria.
My code is not right. Can anyone help me with this?
here is what I have:
Private Sub cmdsearch_Click()
If Me.optsearch = 1 And Me.txttopic = False Then DoCmd.RunMacro Mtopic
ElseIf Me.optsearch = 1 And Me.txttopic Is Not Null Then
DoCmd.OpenForm "frmresults", acNormal, , Me.txttopic = Forms![frmresults]![txtDes], acFormPropertySettings, acDialog
ElseIf Me.optsearch = 2 And Me.txtdate = False Then DoCmd.RunMacro Mdate
ElseIf Me.optsearch = 2 And Me.txtdate > 1 Then DoCmd.OpenForm "frmresults", acNormal, , Me.txtdate = Forms![frmresults]![txtADate], acFormPropertySettings, acDialog
ElseIf Me.optsearch = 3 And Me.txtdate = False Or Me.txtdates = False Then DoCmd.RunMacro Mdates
ElseIf Me.optsearch = 3 And Me.txttopic > 1 And Me.txttopic > 1 Then DoCmd.OpenForm "frmresults", acNormal, , "Forms![frmresults]![txtADate] Between '#" & Me.txtdate & "#' And '#" & Me.txtdates & "#'", acFormPropertySettings, acDialog
ElseIf Me.optsearch = 4 And Me.txttitle = False Then DoCmd.RunMacro Mtitle
ElseIf Me.optsearch = 4 And Me.txttitle = "*" Then DoCmd.OpenForm "frmresults", acNormal, , Me.txttitle = Forms![frmresults]![txtATitle], acFormPropertySettings, acDialog
Else: DoCmd.RunMacro Mnothing
End If
End Sub
___________________________
Now I was working on it this weekend, and I have it redone with dim code to declare everything at the beginning and it is probably closer to correct syntax. That can only mean one thing. I didnt bring it in from home. If I am told that this is completely wrong, I will post that code next. Please help.
Thanks in advance.
Donkeygirl,
Kickin' the crap out of Access