go to record

  • Thread starter Hans - DiaGraphIT -
  • Start date
H

Hans - DiaGraphIT -

Hi!

I'm new to access database.
I have a simple table [allCodes] with 3 columns [myID], [myCode] and
[myCodeText]

I've created a simple form with wizard and selected simple skjema, view a
record at time.
The thing I want to do is to create an textbox where I can type a myCode,
and a button to click. On click event I wish to go to then actual record
wich holds the current myCode and display the text.

Is there a simple way? I do not know what wrongdoing am doing.
Here's my humble code:

DoCmd.GotoRecord acDataForm, me.MyCode, acGoTo, me.tbxFindCodeText.Text


When runng the form I can travel back and forth with the records, but after
typing a value in the textbox and click on button I recieve following error

run-time error '2185' and saying something about missing focus.

Apreciates any help.
 
O

OldPro

Hi!

I'm new to access database.
I have a simple table [allCodes] with 3 columns [myID], [myCode] and
[myCodeText]

I've created a simple form with wizard and selected simple skjema, view a
record at time.
The thing I want to do is to create an textbox where I can type a myCode,
and a button to click. On click event I wish to go to then actual record
wich holds the current myCode and display the text.

Is there a simple way? I do not know what wrongdoing am doing.
Here's my humble code:

DoCmd.GotoRecord acDataForm, me.MyCode, acGoTo, me.tbxFindCodeText.Text

When runng the form I can travel back and forth with the records, but after
typing a value in the textbox and click on button I recieve following error

run-time error '2185' and saying something about missing focus.

Apreciates any help.
--
Best regards
Hans Årsjö
System and software developer
DiaGraphIT AS

A textbox must have the focus if any of its properties are
referenced. Try:

DoCmd.GotoRecord acDataForm, me.MyCode, acGoTo, me.tbxFindCodeText

It will let you reference the default property if you don't include
the property name (.text).
 
H

Hans - DiaGraphIT -

Hi!
Thank you for your reply!
I have tride your code hoping for the best.

Forgive me my ignorance, but this time I recieve an error message

"run-time error '2489'
Object 16 is not open".

What am I doing wrong? In sted of DoCmd.GoToRecord, should I rather use
DoCmd.FindRecord....?

The textbox is in the on the top in the form and not in the details.area.

--
Best regards
Hans Årsjö
System and software developer
DiaGraphIT AS


OldPro said:
Hi!

I'm new to access database.
I have a simple table [allCodes] with 3 columns [myID], [myCode] and
[myCodeText]

I've created a simple form with wizard and selected simple skjema, view a
record at time.
The thing I want to do is to create an textbox where I can type a myCode,
and a button to click. On click event I wish to go to then actual record
wich holds the current myCode and display the text.

Is there a simple way? I do not know what wrongdoing am doing.
Here's my humble code:

DoCmd.GotoRecord acDataForm, me.MyCode, acGoTo, me.tbxFindCodeText.Text

When runng the form I can travel back and forth with the records, but after
typing a value in the textbox and click on button I recieve following error

run-time error '2185' and saying something about missing focus.

Apreciates any help.
--
Best regards
Hans Årsjö
System and software developer
DiaGraphIT AS

A textbox must have the focus if any of its properties are
referenced. Try:

DoCmd.GotoRecord acDataForm, me.MyCode, acGoTo, me.tbxFindCodeText

It will let you reference the default property if you don't include
the property name (.text).
 
O

OldPro

Hi!
Thank you for your reply!
I have tride your code hoping for the best.

Forgive me my ignorance, but this time I recieve an error message

"run-time error '2489'
Object 16 is not open".

What am I doing wrong? In sted of DoCmd.GoToRecord, should I rather use
DoCmd.FindRecord....?

The textbox is in the on the top in the form and not in the details.area.

--
Best regards
Hans Årsjö
System and software developer
DiaGraphIT AS



OldPro said:
Hi!
I'm new to access database.
I have a simple table [allCodes] with 3 columns [myID], [myCode] and
[myCodeText]
I've created a simple form with wizard and selected simple skjema, view a
record at time.
The thing I want to do is to create an textbox where I can type a myCode,
and a button to click. On click event I wish to go to then actual record
wich holds the current myCode and display the text.
Is there a simple way? I do not know what wrongdoing am doing.
Here's my humble code:
DoCmd.GotoRecord acDataForm, me.MyCode, acGoTo, me.tbxFindCodeText.Text
When runng the form I can travel back and forth with the records, but after
typing a value in the textbox and click on button I recieve followingerror
run-time error '2185' and saying something about missing focus.
Apreciates any help.
--
Best regards
Hans Årsjö
System and software developer
DiaGraphIT AS
A textbox must have the focus if any of its properties are
referenced. Try:
DoCmd.GotoRecord acDataForm, me.MyCode, acGoTo, me.tbxFindCodeText
It will let you reference the default property if you don't include
the property name (.text).- Hide quoted text -

- Show quoted text -

Yeah, you're right. The syntax is all wrong. Try this:

DoCmd.GoToControl "MyCode"
DoCmd.FindRecord tbxFindCodeText

This assumes a textbox named tblFindCodeText and a control named
MyCode.
 

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