GoToRecord Sintax

R

Raul Sousa

Hello all,
I have a command bottom which takes the user to the record the user want to
go to.
I try to avoid filtering the records.
So, i think to use the GoToRecord Method.

I am not familiar with this method so I am requesting for help.

I though of the fowling code:
CDArt = InputBox(Message, Title)
DoCmd.GoToRecord , , acgoto, ArtCode = CDArt

But it is not working. I think it is because of the â€ArtCode = CDArt†part.
 
T

Tom Lake

Raul Sousa said:
Hello all,
I have a command bottom which takes the user to the record the user want
to
go to.
I try to avoid filtering the records.
So, i think to use the GoToRecord Method.

I am not familiar with this method so I am requesting for help.

I though of the fowling code:
CDArt = InputBox(Message, Title)
DoCmd.GoToRecord , , acgoto, ArtCode = CDArt

But it is not working. I think it is because of the "ArtCode = CDArt"
part.

If ArtCode is a text field, try

DoCmd.GoToRecord , , acgoto, "ArtCode = '" & CDArt & "'"

Otherwise try

DoCmd.GoToRecord , , acgoto, "ArtCode = " & CDArt

Tom Lake
 
R

Raul Sousa

Hi tom,
Thank you for your reply.
Unfortunately your suggestion is not working.
I get the following error message:
An expression at argument 4 has an invalid value.



"Tom Lake" escreveu:
 
M

missinglinq via AccessMonster.com

I think the problem is that you're missing brackets around ArtCode. I think:


DoCmd.GoToRecord , , acgoto, "ArtCode = " & CDArt

should be :

DoCmd.GoToRecord , , acgoto, "[ArtCode] = " & CDArt
 
M

missinglinq via AccessMonster.com

Or actually

DoCmd.GoToRecord , , acgoto, "[ArtCode] = '" & CDArt & "'"

Sorry! ;0)>

I think the problem is that you're missing brackets around ArtCode. I think:

DoCmd.GoToRecord , , acgoto, "ArtCode = " & CDArt

should be :

DoCmd.GoToRecord , , acgoto, "[ArtCode] = " & CDArt
 
R

Raul Sousa

Thank you for your reply
Unfortunately now I have this error message:

An expression has an incorrect data type for one of the arguments



"missinglinq via AccessMonster.com" escreveu:
Or actually

DoCmd.GoToRecord , , acgoto, "[ArtCode] = '" & CDArt & "'"

Sorry! ;0)>

I think the problem is that you're missing brackets around ArtCode. I think:

DoCmd.GoToRecord , , acgoto, "ArtCode = " & CDArt

should be :

DoCmd.GoToRecord , , acgoto, "[ArtCode] = " & CDArt
 
D

Douglas J. Steele

If ArtCode is a numeric field, remove the single quotes:

DoCmd.GoToRecord , , acgoto, "[ArtCode] = " & CDArt

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Raul Sousa said:
Thank you for your reply
Unfortunately now I have this error message:

An expression has an incorrect data type for one of the arguments



"missinglinq via AccessMonster.com" escreveu:
Or actually

DoCmd.GoToRecord , , acgoto, "[ArtCode] = '" & CDArt & "'"

Sorry! ;0)>

I think the problem is that you're missing brackets around ArtCode. I
think:

DoCmd.GoToRecord , , acgoto, "ArtCode = " & CDArt

should be :

DoCmd.GoToRecord , , acgoto, "[ArtCode] = " & CDArt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top