GoToRecord

reburton

Registered User.
Local time
Today, 10:14
Joined
Nov 4, 2013
Messages
46
I am struggling with syntax for the GoToRecord command. I have a form that is linked to a Query. The recordset contains multiple records for every Invoice number (txtID). I want to move through the records one invoice number at a time. I Have tried all of the following:
DoCmd.GoToRecord acDataForm, "frmInvoice", acGoTo, txtID -1
DoCmd.GoToRecord acDataForm, "frmInvoice", acGoTo, "txtID"-1
DoCmd.GoToRecord acDataForm, "frmInvoice", acGoTo, "txtID -1"
DoCmd.GoToRecord acDataForm, "frmInvoice", acGoTo, "txtID" & -1
Am I going about this the wrong way, or am I just messing up the syntax again? :confused:
 
What exactly are you trying to do?

Are you trying to Open a Form to a specific record?

What logic is giving multiple invoices with the same Invoice Number?

It sounds like your table and relationships structure is not designed.
 
I have a form that is linked to a query which returns several rows for each Invoice Number (one for each line of detail ). Right now when I click on the command button for next or previous to move forward or backward through the Invoices I have to click once for each record. In effect you stay at one invoice while clicking over and over to move to the next invoice. I want to be able to click once for each Invoice Number. I believe you can do that with the GoToRecord command, but syntax is my weakest suite. :banghead:
 
I am using a main form with a sub form. but it doesn't work the way you describe. Clicking on the navigation buttons in the main form takes you through all of the records in the sub form. I have navigation buttons that I created with the command button wizard but I tried enabling the form's navigation buttons and they do the same thing. I would love to find some simple fix like a property change, but I'd still like to get a handle on the syntax of the GoToRecord command. I'm never sure when I need quotation marks. :confused:
 
Last edited:
I must admit that I don't know what a PHP file is. When I look the file up with Windows Explorer and click on it my db comes up. Perhaps I did something wrong when I attached the file. I'll try again and see what happens. ;)
View attachment Invoices.accdb
I'm not hopeful; everything I did appeared to go just like the last attempt and I didn't see any other options in the process.
 
In case you are able to open the db, I just realized that the wizard used the line: "On Error Continue Next" to suppress errors. I commented that line out and am now getting the error message: "An expression you entered is the wrong data type for one of the arguments." That doesn't help me very much, but I am hopeful it will help you.
 
Hi,

Just remove the table "tblInvDetail" on your qryInvoice and that should do the trick.

Contractor
 
Thanks! That did it. I would certainly never thought of that! Would you mind explaining why? I can see that The table wasn't needed, but I don't understand why having it in the query made it behave the way it did. For that matter, what led you to the problem? Always ready to learn something. Besides I'm just plain curious. :)
 
Hi,

for example :

you have a invoice n° 126 and in that invoice you have 4 detail records.

When you add invDetail to your query it creates 4 lines for the invoice n° 126 instead of 1

contrcator
 
Dear Contractor,
Thanks again, for all the help. I don't know if you will see this since I marked the thread solved, but I have discovered a new problem. It was apparently caused by the change we made to the db. The issues I was having originally seem to be solved by removing the tblInvDetail table as you suggested. But the fix seems to have created a new problem. The "new invoice" process doesn't work at all. It was working perfectly before making the change, so I imagine there is an easy fix, but everything I have tried seems to make it worse. I am stumped. Can you point me in the right direction?
Also, much to my embarrassment, I have lost the original db I sent you. Is it possible to get a copy of he original I sent you? :o
 
Last edited:
Maximize your chance to gain help by saving your DB in a previous version of Access (2003 is the best). My 2007 Access version is not able to open the DB.
 
hi Reburton,

I still have your Orginal db, I have looked at your problem that you can not create a new record and found that you have entered on the control "cbobilName" an inputmask. And i have removed it so now it works properly I think.

This was causing an error.

I will attach both db's so you can compare.

Don't forget to click on the thanks button on the form :)

success,

Contractor
 

Attachments

Many Thanks! My appreciation is real but my ignorance is greater still; I don't know where to find the thanks button. :o
 
Below right on my last post you can find the Thanks button :)

See attachment
 

Attachments

  • Thanks Button.jpg
    Thanks Button.jpg
    11.8 KB · Views: 159

Users who are viewing this thread

Back
Top Bottom