Hello everyone, first of all, I'm experiencing a very strange situation.
There's a saved query in my database, I called it "csPortada_Dictamen". Its purpose is to serve a mail merge word document. I went through the mail merge wizard to link the fields and it all works fine... if done manually.
If I go to the word document in windows explorer, and then I double click it to open it, it opens correctly. Then it asks if I want to run a select query to link its fields to those of the "csPortada_Dictamen" query. I accept and it all goes well, it shows me all of the available merges.
If I then "hard code" my query by entering, say, record 234 in the Where criteria of the query builder, and then I save it, and then I go and double click the docx file from windows explorer, it works fine too. It shows me only the record that I need. I was happy and everyone rejoiced.
BUT THEN I did the logic step of going into my form, where I can select the record I really want. And then I went into the saved query and entered the forms!frmSomething.form!FieldID in its criteria. I tested it and the query worked fine, effectively filtering the results to show only that of the form. Saved all, created a button to simply open the word document like this:
AND NOPE. It said it didn't find my database. It's stored in a path like this: c:/folder/db.accdb and when the button opened the file, it said "can't link because c:/folder.mdb can't be found"
So I'd like to know how to just press a button to open the word document with its mail merge properly assigned from my query. If I hard code the record I want, instead of forms!frmSomething.form!FieldID and then I press the button, it works fine. Why can't it do it the same when the form is open and the query has its forms!frmSomething.form!FieldID in its criteria field?
Does any of this make sense to you?
There's a saved query in my database, I called it "csPortada_Dictamen". Its purpose is to serve a mail merge word document. I went through the mail merge wizard to link the fields and it all works fine... if done manually.
If I go to the word document in windows explorer, and then I double click it to open it, it opens correctly. Then it asks if I want to run a select query to link its fields to those of the "csPortada_Dictamen" query. I accept and it all goes well, it shows me all of the available merges.
If I then "hard code" my query by entering, say, record 234 in the Where criteria of the query builder, and then I save it, and then I go and double click the docx file from windows explorer, it works fine too. It shows me only the record that I need. I was happy and everyone rejoiced.
BUT THEN I did the logic step of going into my form, where I can select the record I really want. And then I went into the saved query and entered the forms!frmSomething.form!FieldID in its criteria. I tested it and the query worked fine, effectively filtering the results to show only that of the form. Saved all, created a button to simply open the word document like this:
Code:
Application.FollowHyperlink strFile
So I'd like to know how to just press a button to open the word document with its mail merge properly assigned from my query. If I hard code the record I want, instead of forms!frmSomething.form!FieldID and then I press the button, it works fine. Why can't it do it the same when the form is open and the query has its forms!frmSomething.form!FieldID in its criteria field?
Does any of this make sense to you?