Pb VBA

Claude Parisel

New member
Local time
Today, 14:08
Joined
Aug 29, 2025
Messages
2
Bonjour,

je voudrais aller dans un formulaire [fiche-personnes] à un enregistrement dont le champs [PN] de type texte m’est connu dans un variable [père] :

DoCmd GoToRecord acDataForm, « [fiche-personnes] », « PN = ' " Père & « ' »

mais ce n’est pas accepté.

PN est un champs texte et père un texte

Où est le problème ?



Merci pour votre aide,

Claude
 
Welcome to Access World! We're so happy to have you join us as a member of our community. As the most active Microsoft Access discussion forum on the internet, with posts dating back more than 20 years, we have a wealth of knowledge and experience to share with you.

We're a friendly and helpful community, so don't hesitate to ask any questions you have or share your own experiences with Access. We're here to support you and help you get the most out of this powerful database program.

To get started, we recommend reading the post linked below. It contains important information for all new users of the forum:

https://www.access-programmers.co.uk/forums/threads/new-member-read-me-first.223250/

We hope you have a great time participating in the discussion and learning from other Access enthusiasts. We look forward to having you around!
 
Peut-être:
Code:
DoCmd GoToRecord acDataForm, «[fiche-personnes]», «PN = 'Père'»
ou:
Code:
DoCmd GoToRecord acDataForm, «[fiche-personnes]», «PN = '» & Père & «'»
 
Translated
I would like to go in a form [person-sheet] to a record whose field [PN] of text type is known to me in a variable [father]:

DoCmd GoToRecord acDataForm, "[person-fiche]", "PN = ' " Father & " '"

But it is not accepted.

PN is a text field and father a text

What's the problem?

Thank you for your help,

Looks like you have spaces between’ and “

= ' " Father & " '"
 
Langue cible
Je voudrais aller dans un formulaire [person-sheet] vers un enregistrement dont le champ [PN] de type texte me est connu dans une variable [père] :

DoCmd GoToRecord acDataForm, « [person-fiche] », « PN = ' " Père & " ' »

Mais ce n’est pas accepté.

PN est un champ de texte et father un texte

Quel est le problème?

Merci de votre aide

On dirait que vous avez des espaces entre » et «

= ' " Père & " ' »

Merci, super
 
No. @Claude Parisel It is the wrong command - see post #6.
The DoCmd.FindRecord method in Microsoft Access VBA is used to find a specific record based on a search string. It mimics the functionality of the "Find" dialog box in Access.

Code:
Me.[PN].SetFocus
oCmd.FindRecord "Père", , , , , acCurrent

The acCurrent constant for the OnlyCurrentField argument restricts the search to the currently active field.
Use the FindFirst:=True to commence search from the first record

alternatively use search for record
https://learn.microsoft.com/en-us/office/vba/api/access.docmd.searchforrecord
 

Users who are viewing this thread

Back
Top Bottom