473,900 Members | 4,485 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access 2007- Find a Record Command Button on Form Doesn't Work

16 New Member
Hello everyone.

I am new to Microsoft Access and have been creating a database to store records, add new records, update records, delete records, search records, create reports from records, etc.

With that said, I have little experience in this process and have been teaching myself as I go. However, I am now stuck because I created an Update Record Form to update existing records that are stored in a table with a find record button that no longer works.

When I first created the Find Record Command Button it worked beautifully, just as intended, which was strange because I had not even created a code for it. I have spend HOURS researching and trial and error trying to get this button to work again by trying different VBA codes and no luck. Twice, the find record button actually worked and when I exited the form after saving my changes, and went back in and tried it, it stopped working again. I don't understand.

I need to create a VBA code that allows me to find a record based upon any of 13 fields. For instance, I need for the button to work if someone wanted to search according to File Type, or Owner, or Document Number, and so forth.

Can someone please help?!

Thank you.
Nov 15 '11
19 19118
aswgawlag
16 New Member
Pat,

These are the only VBA codes I have within my "FormSearchCMRe cord":

Expand|Select|Wrap|Line Numbers
  1. Private Sub btnCloseForm_Click()
  2.     Dim iResponse As Integer
  3.  
  4.     iResponse = MsgBox("Are you sure?", vbQuestion + vbYesNo, "Cancel Changes?")
  5.     If (iResponse = vbYes) Then
  6.         Me.Undo
  7.         'Cancel = True
  8.         DoCmd.Close
  9.     End If
  10.  
  11.     'Me.Undo
  12.     'Cancel = True
  13.  
  14.     'If DoCmd.RunCommand <> Null Then
  15.     '    DoCmd.RunCommand SetWarnings = False
  16.     '    DoCmd.RunCommand acCmdDeleteRecord
  17.     '    DoCmd.RunCommand SetWarnings = True
  18.     'End If
  19.     'DoCmd.Close
  20. End Sub
  21.  
  22. Private Sub Form_Load()
  23.     DoCmd.GoToRecord , , acNewRec
  24.     DoCmd.OpenForm "FormSearchCMRecord", , , , acFormReadOnly
  25. End Sub
I didn't write a VBA code for the "btnSearchRecor d" and it is working as intented now. I also added that last code, which has locked my records, so they can not be changed in any. I just didn't want users to be able to manipulate the records, especially unknowingly. The purpose of this is to better control our data. The other forms, which allow for additions, deletions, and updates are all restricted with a password, yet all linked to one table that stores all the data for a given record.

Also, to answer your other question: The form consists of 6 text boxes being the data in these fields is always changing to something different, so if I used a combo box, it would be ridiculously long. However, if they enter an invalid "Document Number", which does have a text box for instance, then when they search it will obviously come up with no results. Additionally, I have included 8 combo boxes being these fields include data that has less variability. The form is set up, so the users may search by the document number, or the owner, or the file type, and so forth...just depending on what exactly they need to know. If additions are made to the fields that have combo boxes, then the choices within the combo box are automatically updated as well.

I hope I am explaining this clear enough.

Thanks again for all of your feedback. It is much appreciated.
Nov 17 '11 #11
aswgawlag
16 New Member
NeoPa,

I will definitely take a look. I have skimmed over some things involving filtering, yet was still unsure about the difference between using a filter and a find record button...if there is a difference, but from my understanding it seemed there was. I briefly tried using a filter even though I was unsure if that was what I needed or not.

At this point, I just created a find record button, which is what the add button wizard called the function.

Thank you for the articles. The information is appreciated, especially since I am still very much a beginner and am doing my best to learn and understand how Access functions.
Nov 17 '11 #12
NeoPa
32,584 Recognized Expert Moderator MVP
You're welcome.

The difference between them is that a filter shows only records that match any specific criteria, whereas a find takes you to such a record. If you consider a table of a hundred records where ten match a specific set of criteria then filtering shows only those ten records, whereas a find simply takes you to the first record it finds to match the criteria. It still shows all one hundred records.
Nov 17 '11 #13
patjones
931 Recognized Expert Contributor
Well, there is nothing in your code that would perform a find on the button click event, so it is certainly being accomplished via a macro. You do get a Find dialog box when you click the button, yes? And this functionality is working correctly, yes?

Pat
Nov 18 '11 #14
aswgawlag
16 New Member
Pat,

Yes I do get a find dialog box whwn I click the button and the functionality is working correctly. Thank you.

Since the weekend, I have opened my database and everything except for my Delete Record Form seems to be working. When I click on my btnDeleteRecord after finding the record I want to delete, a message box pops up stating something along the lines of...You are about to delete (1) record. If you perform this function, you will not be able to undo this. Are you sure you sure you want to continue? When I select yes to delete and check in my table, the record has not been deleted. Any idea on what may have happened or a way to prevent this from happening again?

Thank you.
Nov 21 '11 #15
NeoPa
32,584 Recognized Expert Moderator MVP
I can only guess you are somehow dealing with a ReadOnly table for some reason. Are you able to add a new record or update an existing one using the same form?
Nov 21 '11 #16
aswgawlag
16 New Member
Well, I did change my Search Configuration Record Form to Read-Only Friday, so that may have something to do with it.

I was asked to create a seperate form for each function to help control documents. So, to answer your question, I cannot add or update a record using the Delete Configuration Record Form. I have a seperate Add Configuration Record Form to add records and an Update Configuration Record Form to update records. Those are restricted with passwords. The Search Configuration Record Form is open to any user who has access to oue network, yet is set to Read-Only to prevent any changes to the master table of records.
Nov 21 '11 #17
NeoPa
32,584 Recognized Expert Moderator MVP
We appear to be talking at cross-purposes. I was referring to the state of the record source that the form is bound to. You appear to be referring to the form itself (though how that would make sense is beyond me). Perhaps you could clarify.
Nov 21 '11 #18
aswgawlag
16 New Member
O.k. If my table is set to read-only I did not intentionally do this. How would I go about finding that out?

Now my btnDeleteRecord is working just fine. I find that this continues to happen from time to time, yet I am unsure of why. Sometimes records were added to my table when I would merely search for the record, yet now that I have set my search form to read-only that has stopped happening. This would also happen if I would go to add a record using my Add Configuration Record Form and when I would cancel and close out to my CM Menu, the record would still be added.

And just to clarify that...I was testing the database to see if someone were to go to add a record and change their mind or need to close out without adding the record, I wanted the user to be able to click on the btnCloseForm and the record be canceled and not added.

And now, when I use my Search Configuration Record Form and search for Document Number 10001, for example, it will add a blank 10001 record in my table for some reason, yet was not doing this Friday when I left work.
Nov 21 '11 #19
NeoPa
32,584 Recognized Expert Moderator MVP
You're still talking about setting a form to Read/Only without explaining what you mean by that. I see no ReadOnly property available for forms so as far as I can see you're still making no sense (hence my request for clarification). I will try to deal with your points notwithstanding that, but I may not be able to in the circumstances.
  1. If it were Read Only I would not expect it ever to allow additions, updates or deletions. I expect this means that the record source is not the issue.
  2. This paragraph only tells me that you have a bunch of confusions and code which is not working as you seem to think it is. Having no information on this other than your oblique allusions to it though, I cannot comment.
  3. This paragraph tells me nothing further.

As far as I can tell we're still in the same position we were in before (fundamentally) , except I now suspect, assuming your comments are accurate and reliable, that the issue is not with the Record Source itself. As this was what I was after though, it does indicate that my idea was not a route to a solution.

Clearly you have other issues with your setup, but as we have no details of your setup we're in no position to help further as far as I can see. You should understand that it's your responsibility for ensuring the question makes sense and is supported by the relevant information. While I understand this is not always easy, it's not something anyone else can do for you (any more than I have already tried to prompt you anyway), so it's down to you.
Nov 21 '11 #20

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1496
by: aviklund | last post by:
Hi, I made a simple data access page with a search button that does work properly, but now I would like to add a filtering to the command button also. Ideal solution would be like this: When you press the command button it prompts you a search word (text string) and then it filters the record set and shows all the records
1
2429
by: crazdandconfusd | last post by:
I created a form based on one table and was able to find information using find record and searching entire form. Now I split the information into two tables: one for the front of a page to be printed and another for the back to be printed. Now when I search for information in the entire form and will only search the record displayed. I'm trying to search the main form and an inserted subform in datasheet view through all records. Please...
3
2854
by: betterdayz | last post by:
hi...im trying to design the "find record" command whereby the user enters an ID Number and than clicks ok and the database does a search for that particular ID...the wizard command uses find and replace but rather i would just like to have "find record"..ive read recent forums on the same question and decided to try a script that was posted in one of the forums...here is the script Dim strFindID As String strFindID = InputBox("Enter...
7
21230
by: darnnnel | last post by:
I have a form and a subform. The subform is displayed as a datasheet. When a user selects a record on the list, I would like the parent for to show the contents of the record selected. Access 2007, has the built in SplitForm, I am creating a 2003 database. I need something similar to the splitform in access 2003.
1
1467
by: trevor glover | last post by:
HI Folks I am trying to use VBA on a form to update a image on a number of reports within an Access Database, (i don't want my users to do this manually), the image relates to department logos, so each department will use a maintenance form to find the logo and then click on a command button to change the report logos. The image object is called image17 and it is the picture properties i want to change. Any help and sample code would be...
3
1464
by: mlb992000 | last post by:
I have a form that has a duplicate record command button and I need to create an event that will clear two of the fields once the duplicate record is clicked so that the user will know that it has been clicked. Can anyone help me create this event or any event that will notify the user that the duplicate record button has been clicked?
1
2306
by: mlb992000 | last post by:
I have a form that has a duplicate record command button that allows the user to duplicate all information on the form and change two fields. I need to create an event that will clear the two fields once the duplicate record is clicked so that the user will know that it has been clicked. Can anyone help me create this event or any event that will notify the user that the duplicate record button has been clicked?
2
3455
by: falroc | last post by:
I created a Access 2007 database that had a add record command button that worked just fine until I split the database and made Sqlexpress 2005 the backend. Now, when I click on the add record command button all I get is the error "You can't go to the specified record. My question is why and what can I do to fix it? Thanks in advance.
5
15984
by: Kat7 | last post by:
Hello out there! I've turned into an internet junkie trying to find the answer to this seemingly simple question. Every suggestion I try has failed. Form wizard, VBA, macros, modules ... I never wanted to know so much about SQL statements. If it's not obvious, please be aware I'm not a programmer, just a clerk who happens to know too much about Access for her own good. I AM willing to learn whatever you are patient enough to teach, if...
5
3510
by: slenish | last post by:
Hello all, What im trying to create is a command button that will go to the next record on a table, but its not quite as easy as it sounds :D What I have is a form where you can pull a record based on the criteria of 3 text boxes. Once you type that in a few other text boxes fill in with the information from the record on the table. Now sometimes there might be duplicate records matching the critera, this is where the button comes...
0
10866
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10978
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9672
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8045
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7204
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5892
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6084
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4724
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4305
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.