Full Version: acForm
UtterAccess Forums > Microsoft® Access > Access Forms
S_R_T
Hi all,
This is an easy one
what does that mean?
DoCmd.Close , acForm.FrmMemberSearch
if it does not mean anything
I am trying to make FrmMemberSearch close after it find its results and displays them
Thank you all
argeedblu
CODE
  docmd.close acform, "FrmMemberSearch"
would be the correct syntax. acForm is an Access defined constant.
Glenn
S_R_T
Thank you Sir, if i knew 10% of what you know, my life would have been easier
o you mind checking this out and tell me why the Case else for MsgBox if not working
Private Sub FindMember_Click()
Select Case Combo5
Case "First Name"
DoCmd.OpenForm "MembersContactInformation", , , "[FirstName]like" & "'" & "*" & Me![SearchFor] & "*" & "'"
DoCmd.Close acForm, "FrmMemberSearch"
Case "Last Name"
DoCmd.OpenForm "MembersContactInformation", , , "[LastName]like" & "'" & "*" & Me![SearchFor] & "*" & "'"
DoCmd.Close acForm, "FrmMemberSearch"
Case Else
MsgBox "No Member found with that name"
End Select

End Sub
argeedblu
The way I usually check filters that I build in code is by putting a breakpoint on the next statement and then looking at the string that has been created. You could do this by slightly changing your code and assign the filter to a variable and appended the variable to the openform statement. Or you could temporarily comment out the open form statment and replace it with a debug.print filterstring. Replace filterstring with the filter portion of your open form statement.
I'm just on my way out of town, so if you are unable to track down the problem this way, post another message in this thread and I will experiment with your string tomorrow.
Glenn
ScottGem
Looking at your code it would appear that you have a combobox (Combo5) where the user chooses the string First Name or Last Name. If so, then Case Else will never be reached since the combo should only have the 2 choices.
Frankly I would not do it that way. One alternative is to have 2 search combos labeled First and Last. The RowSource of First would be:
SELECT ContactID, [FirstName] & " " & [LastName] AS Fullname FROM table ORDER BY Fullname
The RowSource for Last would be:
SELECT ContactID, [LastName] & ", " & [FirstName] AS Fullname FROM table ORDER BY Fullname
This would allow the user to search the contacts table by first or last name and bring up the record they want.
Hope this helps,
S_R_T
hmmm, i am going to give that a shot, where to you implement a message box if no members where found under the search?
Jack Cowley
My 3 cents worth... If the combo box(es) are based on people in the database why would you need a message that no one was found? If you select a name from the combo box the person exists in the db and will be found...
ack
S_R_T
we are not selecting a person from a combo box, the combo box is just to chose, Search by first Name, OR search by LastName. the text box is where you type in a portion of the whole name you are loooking for.
I am trying to let it give the user a msb box if no records are found instead of the bd opening the FrmMemberInfo on add mode.
Jack Cowley
Why not make a combo box that is based on the names in the database? This will eliminate typos and should be faster for your users becase when they start to type in a combo box the combo box will move towards the name. If the user types W then the combo box will move to the first name the starts with W and continues to narrow down the selection as they type. You can have two combo boxes, one for LastName and one for FirstName if you like.
Just a thought...
Jack
S_R_T
i like that , how do you make the combo box start mocing the the W or what ever the person inputs
is that done automatically or are is there a code of setup for it??
Thank you for the ideas man, it is always good to get a fresk set of eyes on a problem
lol
thank you all
Jack Cowley
You can, if you like, create a form based on the table or query that will show the record(s) you want to search for. Once the form is complete add a combo box to the form using the Wizard. On the first screen to the Wizard select the 3rd item, "Find a record....". Finish the Wizard. No selecting a record form the combo box will result in that record being displayed on the form.
The combo box will automaticlly move to the record as you type... Auto Expand is set to Yes by default.
hth,
Jack
ScottGem
You apparently missed what I said (though Jack didn't). The idea is that you create two search combos, one sorted by first name, the other by last name. using the AutoExpand property, the user can start typing in either box and it will fill in the first matching record it finds. If it doesn't find a match the user can see that and no message is needed.
Hope this helps,
S_R_T
It is not that i missed what you said, i kinda did not read it, that clown pictures disturbs my focus, and i can no longer comprehend what i am reading
ol
no, i see how you tried to explain that idea for me before, but it was a little above my access knowledge. Jack in the other hand was talking wizard, just what i like to hear lol
You guys are great and one day i iwll know enough about access that i will have an opinion also lol
ScottGem
Umm, I thought you knew what a search combo was. You've been hanging around here long enuf frown.gif If you've ever used the Wizard to create a combo (I do all the time, even though I can do it from scratch, its just easier to use the wizard), you should have noticed that third choice.
assume you've got it now. Isn't it better then using the method you devised?
S_R_T
i did know what a search combo was but to be honest with you, i read a bunch of threads for the heck of it so i can learn more stuff, and i have noticed that there are alot of very simply things that i did not know, and when i was reading your post, i kinda read to much into it , i startinged visualizing to much detail when it was just a simple task..
Just a little guy overwhelmed by the big dogs. lol
but i promise next time i get a post from youl i will read it better
thank you buddy
ScottGem
No problem. Glas I was able to assist. I know I try to look for the least complex solutions. Especially the ones that require the least amount of coding.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.