Go Back   Access World Forums > Microsoft Access Discussion > Macros

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 05-15-2019, 07:43 AM   #1
Harry Taylor
Newly Registered User
 
Join Date: Jul 2012
Posts: 41
Thanks: 13
Thanked 0 Times in 0 Posts
Harry Taylor is on a distinguished road
Macro To Go To TextBox Record

Please help.

I have set a button to open a form [HNumber] with a text box - [Text8]

I want to type a record number [Account] in this box and make my form [Heatersmaster] go directly to that record. (unfiltered)

I have a Macro GoToRecord;
Form
Heatersmaster
Go To
[Text8]=[Heatersmaster100]![ACCOUNT]

([Heatersmaster100] is the data table)

It wont work, and I'm sure i'm miles off but can someone please help.
Sorry is its a noob question

Harry Taylor is offline   Reply With Quote
Old 05-15-2019, 07:45 AM   #2
theDBguy
I知 here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 1,980
Thanks: 23
Thanked 506 Times in 495 Posts
theDBguy will become famous soon enough theDBguy will become famous soon enough
Re: Macro To Go To TextBox Record

Hi. If you wan to open a different form, then you should use OpenForm instead of GoToRecord. Then, in the WhereCondition argument, you could add the filter/criteria for the account number you entered in the textbox. For example, maybe something like this:
Code:
=[Account Number]=[Text8]
Hope it helps...
__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is offline   Reply With Quote
The Following User Says Thank You to theDBguy For This Useful Post:
Harry Taylor (05-15-2019)
Old 05-15-2019, 07:55 AM   #3
Harry Taylor
Newly Registered User
 
Join Date: Jul 2012
Posts: 41
Thanks: 13
Thanked 0 Times in 0 Posts
Harry Taylor is on a distinguished road
Re: Macro To Go To TextBox Record

Thanks theDBguy.

I tried the OpenForm path but it filtered my database.

So record say 164 of 3000 became record 1 of 1

Harry Taylor is offline   Reply With Quote
Old 05-15-2019, 08:05 AM   #4
theDBguy
I知 here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 1,980
Thanks: 23
Thanked 506 Times in 495 Posts
theDBguy will become famous soon enough theDBguy will become famous soon enough
Re: Macro To Go To TextBox Record

Quote:
Originally Posted by Harry Taylor View Post
Thanks theDBguy.

I tried the OpenForm path but it filtered my database.

So record say 164 of 3000 became record 1 of 1
Okay, so I guess you're saying you want to keep all the records but simply display the selected record instead. Just to be clear, are we trying to open a completely different form than the one where the textbox is located? If so, I am assuming both forms have the same record source, correct? If so, why do we have two different forms to display the same set of records? If this is not the case, then I guess we just want to display the record entered in the texbox on the same form where the textbox is located, right? If so, then yes, we should use the GoToRecord or something similar, I am thinking something like the SearchRecord action.
__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is offline   Reply With Quote
Old 05-15-2019, 08:14 AM   #5
Harry Taylor
Newly Registered User
 
Join Date: Jul 2012
Posts: 41
Thanks: 13
Thanked 0 Times in 0 Posts
Harry Taylor is on a distinguished road
Re: Macro To Go To TextBox Record

I have one main form [Heatermaster].

All I want is to be able to jump to a selected record without users having to go to a tiny Record box at the bottom of the form. I thought text box may be the answer, but there may be a better way.

I'm surprised this isn't a standard feature in Access (2010)
Harry Taylor is offline   Reply With Quote
Old 05-15-2019, 08:19 AM   #6
Gasman
Enthusiastic Amateur
 
Join Date: Sep 2011
Location: Swansea, South Wales,UK
Posts: 3,422
Thanks: 373
Thanked 591 Times in 573 Posts
Gasman has a spectacular aura about Gasman has a spectacular aura about Gasman has a spectacular aura about
Re: Macro To Go To TextBox Record

Well your assignment is in the wrong direction?
As theDBGuy showed you it should be

Code:
[Heatersmaster100]![ACCOUNT]=[Text8]
I hardly ever use Macros so not sure whether that syntax is absolutely correct, but the assignment certainly is.?
__________________
Access novice. Sometimes trying to give something back.
Access 2007


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Gasman is online now   Reply With Quote
Old 05-15-2019, 08:33 AM   #7
theDBguy
I知 here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 1,980
Thanks: 23
Thanked 506 Times in 495 Posts
theDBguy will become famous soon enough theDBguy will become famous soon enough
Re: Macro To Go To TextBox Record

Quote:
Originally Posted by Harry Taylor View Post
I have one main form [Heatermaster].

All I want is to be able to jump to a selected record without users having to go to a tiny Record box at the bottom of the form. I thought text box may be the answer, but there may be a better way.

I'm surprised this isn't a standard feature in Access (2010)
Actually, this is sort of a standard in Access. Try adding a combobox on the header area of your form using the Combobox Wizard and select the third option.

__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is offline   Reply With Quote
The Following User Says Thank You to theDBguy For This Useful Post:
Harry Taylor (05-16-2019)
Old 05-15-2019, 10:48 AM   #8
Gasman
Enthusiastic Amateur
 
Join Date: Sep 2011
Location: Swansea, South Wales,UK
Posts: 3,422
Thanks: 373
Thanked 591 Times in 573 Posts
Gasman has a spectacular aura about Gasman has a spectacular aura about Gasman has a spectacular aura about
Re: Macro To Go To TextBox Record

Firstly I think you need SearchFor Record
Then if you look at the help for that the syntax is the same as if in VBA, in that you need to concatenate the variable with the field being searched.?

Their example is
="Description = '" & Forms![frmCategories]![txtDescription] & "'"

Using it on my test for for an ID it would be
="ID = " & [Forms]![Form1]![text20]

but as you specify the type of object and the name of the object, you can shorten it to

="ID = " & [text20]

GoToRecord is for the likes of Next,Last etc

That works, but I think I will stick with VBA, though I have learnt something, avoid macros . :-)

HTH
__________________
Access novice. Sometimes trying to give something back.
Access 2007


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Gasman is online now   Reply With Quote
The Following User Says Thank You to Gasman For This Useful Post:
Harry Taylor (05-16-2019)
Old 05-16-2019, 06:12 AM   #9
Harry Taylor
Newly Registered User
 
Join Date: Jul 2012
Posts: 41
Thanks: 13
Thanked 0 Times in 0 Posts
Harry Taylor is on a distinguished road
Re: Macro To Go To TextBox Record

Thanks theDBguy & Gasman.

I am looking at a ComboBox which does do the job, just need to make it 'pretty' on my form.

I will also investigate the SearchFor Record, but this is a new one for me.

I think the answer (as always) is for me to learn VBA!

Thank guys, you have been a great help.
Harry Taylor is offline   Reply With Quote
Old 05-16-2019, 06:50 AM   #10
theDBguy
I知 here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 1,980
Thanks: 23
Thanked 506 Times in 495 Posts
theDBguy will become famous soon enough theDBguy will become famous soon enough
Re: Macro To Go To TextBox Record

Quote:
Originally Posted by Harry Taylor View Post
Thanks theDBguy & Gasman.

I am looking at a ComboBox which does do the job, just need to make it 'pretty' on my form.

I will also investigate the SearchFor Record, but this is a new one for me.

I think the answer (as always) is for me to learn VBA!

Thank guys, you have been a great help.
Hi. You're welcome. Gasman and I were happy to assist. Good luck with your project.
__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is offline   Reply With Quote
Old 05-16-2019, 08:39 AM   #11
Harry Taylor
Newly Registered User
 
Join Date: Jul 2012
Posts: 41
Thanks: 13
Thanked 0 Times in 0 Posts
Harry Taylor is on a distinguished road
Re: Macro To Go To TextBox Record

Solved it

Button on my form which opens another form [HNumber]
in [HNumber] I have a Combobox with the following macro
-Search for form
-Form
-Heatersmaster
-First
-="[ACCOUNT] = " & Str(Nz([Screen].[ActiveControl],0))
Close Window

Sweet
Harry Taylor is offline   Reply With Quote
Old 05-16-2019, 09:02 AM   #12
theDBguy
I知 here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 1,980
Thanks: 23
Thanked 506 Times in 495 Posts
theDBguy will become famous soon enough theDBguy will become famous soon enough
Re: Macro To Go To TextBox Record

Quote:
Originally Posted by Harry Taylor View Post
Solved it

Button on my form which opens another form [HNumber]
in [HNumber] I have a Combobox with the following macro
-Search for form
-Form
-Heatersmaster
-First
-="[ACCOUNT] = " & Str(Nz([Screen].[ActiveControl],0))
Close Window

Sweet
Good job! Keep it up!!!

__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
macro to open a specific excel worksheet corresponding to a number in a textbox awade Macros 2 07-24-2015 01:31 PM
Excel 2007 Record Macro not work on label or textbox Rx_ Excel 0 07-14-2010 08:40 AM
Clear Textbox OnEvent Macro? shurgs Forms 2 07-06-2010 04:31 AM
Macro which shows a textbox when run Shooting Star Macros 1 02-07-2009 03:41 PM
Macro taking help of query and display output in TextBox prodigy Macros 3 09-02-2005 12:27 AM




All times are GMT -8. The time now is 01:15 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World