Full Version: Help with combining code
UtterAccess Discussion Forums > Microsoft® Access > Access Q and A
dako
Good Day,

I created a simple database to store specific information regarding Real Estate Agents and the thought was to be able to query against specific fields and return any agent's names that match.

Relatively new to programming I was not sure how to write a piece of code that would allow an "And" or "Or" option for the specific fields as well as conduct a search on specific key words within a memo field.

Well somewhere in the code archive (I think) I found two search databases that will do exaclty what I need. Unfortunately, the examples are in two different databases with each having its own special search function.

My question is would it be possible to combine (somehow) the functionality of these two search databases into one?

Any suggestions would be great.
Regards,
Dako
quest4
Good afternoon. Here is an example of a procedure I use with AND in it:
If DCount("[LogOn]", "tblAuthorizedUsers", "[LogOn]='" & MyCurrentUser() & "' And [Assembly] = True") = 0 Then
Response = MsgBox("You Are Not Authorized to Approve This Form." & vbCrLf & "Would You Like to View it Read Only?.", vbYesNo + vbDefaultButton2, "Yes?")
If Response = vbYes Then
Forms!frmCorrectiveAction.AllowEdits = No
Forms!frmCorrectiveAction.AllowAdditions = No
Forms!frmCorrectiveAction.AllowDeletions = No
DoCmd.Maximize
ElseIf Response = vbNo Then
DoCmd.Close ACForm, "frmCorrectiveAction"
End If
Else
DoCmd.Maximize
End If
End If
This just simply only lets authorized users in to write and modify data, all others enter in a read-only mode. I should give you an idea of and & or. I could get your dbase to work, it kept lock up on me. There is probably some conflict or sysntex issues in it. hth.
dako
quest4,

Thanks for the reply. I was able to modify the code from dbSearch and use in current application, but ultimately I also need to search for a "string" within two separate memo fields.

The two examples in the attachemnts do exactly what is needed but I need to combine them possibly into one search.

If you or anyone else could help, it would be greatly appreicated.

Regards,
Dak
quest4
You attachment kept crashing on me so I never really got to see it work. I have attached a little search form I use, maybe you can modify it and use it some where else. hth.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.