Access - Command button not working

danielle67 Posted messages 11 Status Member -  
 danielle67 -
Hello,

Here is the procedure I applied to a command button on my form - it consists of opening another form that displays only the selected records from my active form.
To me, it's gibberish, and on top of that, when I click the command button, it doesn't work - Can someone correct me - thank you in advance

End Sub
Private Sub Trouver_les_mandats_Click()
On Error GoTo Err_Trouver_les_mandats_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "F List of mandates"

stLinkCriteria = "[NUM INVENTAIRE]=" & "'" & Me![NUM INVENTAIRE] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Trouver_les_mandats_Click:
Exit Sub

Err_Trouver_les_mandats_Click:
MsgBox Err.DESCRIPTION
Resume Exit_Trouver_les_mandats_Click

End Sub

Private Sub Trouver_les_mandats_DblClick(Cancel As Integer)

End Sub
Configuration: Windows Vista Internet Explorer 7.0

7 answers

LatelyGeek Posted messages 1774 Registration date   Status Member Last intervention   550
 
I understand what you wanted to do, but the fact that absolutely nothing happens seems strange to me.

stDocName = "F List of mandates"

stLinkCriteria = "[NUM INVENTAIRE]=" & "'" & Me![NUM INVENTAIRE] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

These three lines should open the form. The fact that it might be empty could have an explanation, but the fact that it doesn't open at all...

--
Why make life complicated doing simple things when it is so simple to make it complicated?
0
danielle67 Posted messages 11 Status Member
 
Hello,
if I understand correctly, the blabla I copied should normally work?
This database, in fact, I created it in an earlier version of Access and this command button worked very well and then one day when clicking on it I got an error message. I was told it was a compatibility issue because I have XP on my workstation - I was installed with the latest version of Access - I did the same procedure as before but now nothing, not even an error message) I understand even less...

otherwise I thought of another solution but I need your help because I think I need to go through the blabla:
- In my F Clients, by double-clicking on the CLIENT NUMBER, open this famous F Invoices filtering only the invoices for the selected client - Is that possible, thank you in advance and have a nice day.
0
LatelyGeek Posted messages 1774 Registration date   Status Member Last intervention   550
 
It's also possible, but the problem would be the same.

What I advise you is to remove the button that no longer works and to recreate one. If you don't know anything about it, it doesn't matter, there is an assistant (Make sure the "magic wand" is activated in the toolbar)

Category Form operations
Open a form
Give it a name, then choose the information to display and match the fields of the two forms. I'm not very clear but you'll see it's simple.

It should start working again. The downside of double-clicking on the name is that there is no assistant present to help you do that, you have to write the module by hand. It's possible but less simple to do alone...
--
Why make life complicated when it's so easy to make it complicated?
0
danielle67 Posted messages 11 Status Member
 
Hello,
I went through the assistant to create this button (it's the small square in the form command toolbar – I think that's what it's called – I did operation on the form - open a form - so I selected my form and then it asked me if I wanted to display all records or specific records; I selected the latter and then I had to choose the parent and child fields with the relationship and then I confirmed and named this button, but no matter how much I click or double-click, nothing happens, not even a message; in fact, this button is like inactive (however, in the old version, I click and the form opens...)
As you advised, I did it several times, but no change -
Is there a specific location for this type of button to make it work - I tried inserting it in the detail form and the form header, but no success.
To continue data entry, I actually created a query that opens this form with a filter asking for the CLIENT NUMBER.
Then I created a macro linked to the CLIENT NUMBER field of my F Client that opens F invoice with my query: the result is double-click on this field - I enter the CLIENT NUMBER and my F Invoice opens with all the records of the CLIENT NUMBER; of course, it works, but I am not satisfied because you can make mistakes in the CLIENT NUMBER that you enter before opening the Form and it's not practical, especially for those who will consult the database and who do not know access.
In fact, it is a database that manages the heritage of a municipality with inventory numbers and invoices following various acquisitions - I take the example of the Clients/Invoices DB; it's more relevant in terms of explanation and it's the same principle. I currently have over 4000 invoices and at least 100 inventory numbers. I hope to find a solution to this problem because it's starting to slightly annoy me as I've been working on this thing for several months...
0
LatelyGeek Posted messages 1774 Registration date   Status Member Last intervention   550
 
I can't tell you why it won't open. There's a setting somewhere that's blocking VB, but I can't see where or how to unblock it. It's useless!

However, instead of putting a parameter that asks for NumClient, you can put as a criterion in the query forms!NomDuFormulaire!Num-Client. That will avoid input errors.

The problem is circumvented, but not resolved...
--
Why make life complicated by keeping it simple, when it's so easy to make it complicated?
0
danielle67 Posted messages 11 Status Member
 
If I understood correctly, instead of my message that I wrote as [Please enter the customer number] under my CLIENT NUMBER field, I need to put what you noted, namely: forms!FormName!Client-Number ??
0
LatelyGeek Posted messages 1774 Registration date   Status Member Last intervention   550
 
That's it.
--
Why complicate life by making it simple, when it's so easy to make it complicated?
0
danielle67 Posted messages 11 Status Member
 
Ok, I'll try it tomorrow morning at work and I'll definitely keep you updated. Thanks, have a good afternoon...
0
danielle67 Posted messages 11 Status Member
 
Hello, it's still about my story regarding the form command button:
I opened a new database in the new version of Access and then I imported my tables from my database (created in an older version)
Already I noticed that the extensions in the database name are no longer the same...
I recreated my two forms with the same principle, I created my command button with the help of the wizard and by some miracle finally my form opens but with all the records from the table; And yet I did select to show specific records with child and parent fields - any idea ????
Otherwise, I’m just sticking to my filter query that I apply before opening my second form - it's still frustrating to see that it doesn't work as we want it to and yet Access is still a good tool precisely for doing such manipulations...
0
LatelyGeek Posted messages 1774 Registration date   Status Member Last intervention   550
 
Are you in 2007 now???

If so, I may not be of much help to you anymore. I don't have Access 2007, and I hope I'll never need to have it. What I've seen of it has been enough for me!!!
--
Why make life complicated by doing simple things, when it's so easy to make complicated things?
0
danielle67 Posted messages 11 Status Member
 
oh yes, the latest version of Access with the SUPERB configuration of Vista (and I think I’m not out of the woods yet) Why do computer scientists spend their time changing what used to work just fine? In trying to innovate everything, we find ourselves in awkward situations
Now either I arrange with my boss to change versions (he won't understand anything)
or I resort to tricks that will weigh down my database and in the end I’ll have "a gas factory," a term I don’t like too much but which is in fashion
or I take a programming training - so hello headache

I think I’ll be reading on the forum soon, for my future little tricks and hope to still get some advice ...
.. thanks a lot anyway for your help ...
0
fish13
 
Hello

There is a bug in Access 2007 SP1, the filter on the macro created by the button wizard does not work.... You need to add the = sign on the left in the parameters of the OpenForm macro.... and then it works...

The where condition of the macro should be:

="[ID]=" & [Num_Personnel]

and not

"[ID]=" & [Num_Personnel]

Good luck

Hervé
0
danielle67
 
Thank you for your reply, it's just that since my last message (so last year) I gave up because it was a headache - I will try your thing and keep you informed - thank you very much...
0
LatelyGeek Posted messages 1774 Registration date   Status Member Last intervention   550
 
I am always in a bad mood in the morning, but that's when I have the most time to respond, what a shame.

How do you want us to help you???

What, "it's not working"????

1 - Nothing happens
2 - The form closes
3 - Another one opens
4 - The correct one opens but it's empty
5 - The computer explodes
6 - Your boss fires you
7 - A stranger offers you flowers...

So, which one is it???
--
Why complicate life by simplifying when it's so easy to complicate things?
-1
danielle67 Posted messages 11 Status Member
 
Hello,

Thank you for the "CHARMING" response, I wasn't asking for that much.
The goal was not to ANNOY the forum members but to seek an answer to my problem.
I mentioned that I do not know Access at the "programming" level. I just copied the nonsense that is in the properties of my "C***** button" which, when clicked, does not open the form I want.
To answer your question: nothing happens.

What I want to do is, from form F clients, open form F Invoices displaying only the invoices corresponding to the client I selected in my F client using the field CUSTOMER NUMBER.
I have a one-to-many relationship (1 client for multiple invoices) with referential integrity, and the primary key is the CUSTOMER NUMBER field.

I hope I am clearer now and hope to find you in a better MOOD tomorrow morning, because thank you for the welcome, I just registered on your forum and you are the first person to respond to me...
0