Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 12-07-2018, 12:22 AM   #1
bruceblack
Newly Registered User
 
Join Date: Jun 2017
Posts: 115
Thanks: 41
Thanked 0 Times in 0 Posts
bruceblack is on a distinguished road
Talking Open a form with same ID, but as text string

Hi everyone. I'm stuck in a basement somewhere and need to fix this but cant find a solution all that quick.

I have the following code:

Code:
DoCmd.OpenForm "itemseditform", acNormal, , "[item_ID] = " & Me.item_ID
But the item_ID has been converted intentionally to a text string.

What is the right way to open a form linking to the ID when it's a text string?

Thanks for your help in advance!

bruceblack is offline   Reply With Quote
Old 12-07-2018, 12:26 AM   #2
JHB
Have been here a while
 
Join Date: Jun 2012
Location: In the south of Denmark (Jutland), near the German border.
Posts: 7,649
Thanks: 2
Thanked 2,053 Times in 2,008 Posts
JHB has a spectacular aura about JHB has a spectacular aura about
Re: Open a form with same ID, but as text string

Add ' on both side.

Code:
DoCmd.OpenForm "itemseditform", acNormal, , "[item_ID] = '" & Me.item_ID & "'"
__________________
If the above post has helped you, why not take the time to say thank you, by pressing the "Thumbs up."
JHB is offline   Reply With Quote
Old 12-07-2018, 12:30 AM   #3
bruceblack
Newly Registered User
 
Join Date: Jun 2017
Posts: 115
Thanks: 41
Thanked 0 Times in 0 Posts
bruceblack is on a distinguished road
Re: Open a form with same ID, but as text string

Holy damn. Youre a life saver.

My brain must be sleeping somewhere else.

Thanks a ton!

bruceblack is offline   Reply With Quote
Old 12-07-2018, 12:36 AM   #4
JHB
Have been here a while
 
Join Date: Jun 2012
Location: In the south of Denmark (Jutland), near the German border.
Posts: 7,649
Thanks: 2
Thanked 2,053 Times in 2,008 Posts
JHB has a spectacular aura about JHB has a spectacular aura about
Re: Open a form with same ID, but as text string

Quote:
Originally Posted by bruceblack View Post
..
My brain must be sleeping somewhere else.
Early in the morning by you?
__________________
If the above post has helped you, why not take the time to say thank you, by pressing the "Thumbs up."
JHB is offline   Reply With Quote
The Following User Says Thank You to JHB For This Useful Post:
bruceblack (12-07-2018)
Old 12-07-2018, 12:42 AM   #5
bruceblack
Newly Registered User
 
Join Date: Jun 2017
Posts: 115
Thanks: 41
Thanked 0 Times in 0 Posts
bruceblack is on a distinguished road
Re: Open a form with same ID, but as text string

Quote:
Originally Posted by JHB View Post
Early in the morning by you?
Crapdoodle , yep early and no coffee

Now the form printouts dont work.

Code:
DoCmd.OpenReport "label1", acNormal, , "[item_ID] = '" & Me.item_ID & "'"
i applied the same method :S.....

But for reports is ANOTHER different way???
What is going on?

Last edited by bruceblack; 12-07-2018 at 12:55 AM.
bruceblack is offline   Reply With Quote
Old 12-07-2018, 12:56 AM   #6
JHB
Have been here a while
 
Join Date: Jun 2012
Location: In the south of Denmark (Jutland), near the German border.
Posts: 7,649
Thanks: 2
Thanked 2,053 Times in 2,008 Posts
JHB has a spectacular aura about JHB has a spectacular aura about
Re: Open a form with same ID, but as text string

Could it be that the report have the [item_ID] as a number? Then remove the '.
__________________
If the above post has helped you, why not take the time to say thank you, by pressing the "Thumbs up."
JHB is offline   Reply With Quote
Old 12-07-2018, 12:59 AM   #7
JHB
Have been here a while
 
Join Date: Jun 2012
Location: In the south of Denmark (Jutland), near the German border.
Posts: 7,649
Thanks: 2
Thanked 2,053 Times in 2,008 Posts
JHB has a spectacular aura about JHB has a spectacular aura about
Re: Open a form with same ID, but as text string

Quote:
Originally Posted by bruceblack View Post
..But the item_ID has been converted intentionally to a text string.
..
Converted it to text could cause many problem if you've queries and forms/reports already created.

__________________
If the above post has helped you, why not take the time to say thank you, by pressing the "Thumbs up."
JHB is offline   Reply With Quote
The Following User Says Thank You to JHB For This Useful Post:
Eugene-LS (12-07-2018)
Old 12-07-2018, 01:38 AM   #8
June7
Newly Registered User
 
June7's Avatar
 
Join Date: Mar 2014
Posts: 1,807
Thanks: 0
Thanked 434 Times in 430 Posts
June7 will become famous soon enough June7 will become famous soon enough
Re: Open a form with same ID, but as text string

Do you mean the field in table has been converted to a text data type?
__________________
Attach File Manager is below Advanced editor window, click Go Advanced below Quick Reply window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
DEBUG! DEBUG! DEBUG!
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
June7 is offline   Reply With Quote
Old 12-07-2018, 06:12 AM   #9
Eugene-LS
Newly Registered User
 
Join Date: Dec 2018
Posts: 19
Thanks: 6
Thanked 3 Times in 3 Posts
Eugene-LS is on a distinguished road
Re: Open a form with same ID, but as text string

Quote:
Originally Posted by bruceblack View Post
Hi everyone. I'm stuck in a basement somewhere and need to fix this but cant find a solution all that quick.

I have the following code:

Code:
DoCmd.OpenForm "itemseditform", acNormal, , "[item_ID] = " & Me.item_ID
But the item_ID has been converted intentionally to a text string.

What is the right way to open a form linking to the ID when it's a text string?

Thanks for your help in advance!
...

Fourth argument of DoCmd.OpenForm instruction means WhereCondition in SQL format (without "WHERE ... "), so:

Code:
"[item_ID] = " & Me!item_ID     ' For numeric field
Or

Code:
"[item_ID] = '" & Me!item_ID  & "'"  ' For text field

Last edited by Eugene-LS; 12-07-2018 at 06:18 AM.
Eugene-LS is offline   Reply With Quote
Old 12-07-2018, 06:58 AM   #10
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,275
Thanks: 105
Thanked 2,491 Times in 2,287 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: Open a form with same ID, but as text string

Eugene.
Look at post #2
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
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.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
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.
isladogs is offline   Reply With Quote
The Following User Says Thank You to isladogs For This Useful Post:
Eugene-LS (12-07-2018)
Old 12-07-2018, 07:10 AM   #11
Eugene-LS
Newly Registered User
 
Join Date: Dec 2018
Posts: 19
Thanks: 6
Thanked 3 Times in 3 Posts
Eugene-LS is on a distinguished road
Re: Open a form with same ID, but as text string

Quote:
Originally Posted by isladogs View Post
Eugene.
Look at post #2
I just truing to get 10 posts ... to get some privileges for good start .. .
English - is not my native leng. so i writing as able.
Eugene-LS is offline   Reply With Quote
Old 12-07-2018, 07:24 AM   #12
isladogs
Part time moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 9,275
Thanks: 105
Thanked 2,491 Times in 2,287 Posts
isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all isladogs is a name known to all
Re: Open a form with same ID, but as text string

Hi Eugene
Please don't post just to top up your numbers. It doesn't go down well.
You will soon reach the 'magic ten'
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Website links:
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.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
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.
isladogs is offline   Reply With Quote
The Following User Says Thank You to isladogs For This Useful Post:
Eugene-LS (12-07-2018)
Old 12-07-2018, 07:27 AM   #13
Eugene-LS
Newly Registered User
 
Join Date: Dec 2018
Posts: 19
Thanks: 6
Thanked 3 Times in 3 Posts
Eugene-LS is on a distinguished road
Re: Open a form with same ID, but as text string

Quote:
Originally Posted by isladogs View Post
Hi Eugene
Please don't post just to top up your numbers. It doesn't go down well.
You will soon reach the 'magic ten'
I agree!
Thanks!
I'll be more gantle in next

Eugene-LS is offline   Reply With Quote
Reply

Tags
open form , same id. , text string

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Check value of three text box controls on a form then build text string with results kpaull Forms 3 01-10-2016 04:48 PM
[SOLVED] Get selected text from textbox as filtering string for another form edgaro Forms 4 08-01-2015 09:56 PM
Open Blank Form based on value in Text field in main form manusri Forms 2 06-12-2013 09:51 AM
Open Form by String ted.martin Modules & VBA 2 06-10-2007 05:10 AM
open another form and imort string into it cliff7376 Forms 4 05-14-2002 11:29 AM




All times are GMT -8. The time now is 05:59 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