ID Value to Replace (1 Viewer)

smtazulislam

Member
Local time
Today, 04:50
Joined
Mar 27, 2020
Messages
806
I have Text Box that name is PageNo(FK)
tblPages : PGID(PK), PAGENO(TEXT), PAGEREF(TEXT).
Value Like: 1 - Page- 1, PG1

I would like to do something like,
If I enter the VALUE "1" in the textbox then Move curser to display same textbox "Page- 1" Or "PG1"

Any help will be appreciate...
 

CJ_London

Super Moderator
Staff member
Local time
Today, 02:50
Joined
Feb 19, 2013
Messages
16,635
perhaps use the format property

"Page - "#

use enters 1 and

Page - 1

is displayed

or if a different textbox use the following in the control source

="Page - " & PGID
 

smtazulislam

Member
Local time
Today, 04:50
Joined
Mar 27, 2020
Messages
806
perhaps use the format property

"Page - "#

use enters 1 and

Page - 1

is displayed

or if a different textbox use the following in the control source

="Page - " & PGID
Thank you very much,
Formatting Not work. There I added an example with Page.
But here different Items, I want to do when I enter the code LIKE "1" Then ...Insert text items
 

CJ_London

Super Moderator
Staff member
Local time
Today, 02:50
Joined
Feb 19, 2013
Messages
16,635
You are very good at providing vague requirements :)

Rather than describing what you want, show us - and be consistent in your naming

for example
blPages : PGID(PK), PAGENO(TEXT), PAGEREF(TEXT).
- what is the actual name of your fields PGID or PGID(PK)
and is the PK a numeric or text field?
what does this mean
want to do when I enter the code LIKE "1" Then ...Insert text items
Like is only relevant if using wild card characters

what does
Formatting Not work.
mean? you get an error? doesn't display as required?
 

smtazulislam

Member
Local time
Today, 04:50
Joined
Mar 27, 2020
Messages
806
for example
tblPages : PGID(PK), PAGENO(TEXT), PAGEREF(TEXT).
I have another table That name is tblPayList . and JOIN with table tblPages
TblPages field is : PGID(PK), PAGENO(TEXT), PAGEREF(TEXT).
PGIDPAGENOPAGEREF
1PAGE-1PG1
2NOTHINGNG
3NORMALNR
4PAGE-5PG5

Now tblPayIist field is : PaylistID (PK), PGID(FK), PayDate(Date & Time) PayAmount (Currency)
PaylistIDPGIDPayDatePayAmount
1101/11/20223500 $

NOW, if I enter into field "PGID" "3" in my form "frmPaylist" then can possible to replace text as "NORMAL"
if you have more question lets me know.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 02:50
Joined
Feb 19, 2013
Messages
16,635
use a dlookup function in another control, or use a combo

=dlookup("PageNo","tblPages","PGID=" & PGID)

if you actually want to replace the value 3 with 'NORMAL' in the same textbox, leave it unbound and in the after update event or maybe the lostfocus event put

PGID=dlookup("PageNo","tblPages","PGID=" & PGID)

you will no doubt need additional code if the user doesn't enter a number or enters a letter
 

smtazulislam

Member
Local time
Today, 04:50
Joined
Mar 27, 2020
Messages
806
use a dlookup function in another control, or use a combo

=dlookup("PageNo","tblPages","PGID=" & PGID)

if you actually want to replace the value 3 with 'NORMAL' in the same textbox, leave it unbound and in the after update event or maybe the lostfocus event put

PGID=dlookup("PageNo","tblPages","PGID=" & PGID)

you will no doubt need additional code if the user doesn't enter a number or enters a letter
Thank you very much. I am trying use replace function with bound textbox AFTERUPDATE event.
Code:
Private Sub PGID_AfterUpdate()
Dim dlup As String
dlup = DLookup("PageNo", "tblPageNo", "PGID=" & Me.PGID)
Me!PGID = Replace("Me!PGID", "PGID", "dlup")

End Sub
Have any Idea
 

CJ_London

Super Moderator
Staff member
Local time
Today, 02:50
Joined
Feb 19, 2013
Messages
16,635
So why did you not use what I suggested?
 

CJ_London

Super Moderator
Staff member
Local time
Today, 02:50
Joined
Feb 19, 2013
Messages
16,635
OK, no idea what 'not work' means. please provide detailed explanation

and step through the code and provide details of any errors
 

smtazulislam

Member
Local time
Today, 04:50
Joined
Mar 27, 2020
Messages
806
OK, no idea what 'not work' means. please provide detailed explanation

and step through the code and provide details of any errors
Okay, can you review. I have uploaded my dB.
 

Attachments

  • Database7.accdb
    536 KB · Views: 52

CJ_London

Super Moderator
Staff member
Local time
Today, 02:50
Joined
Feb 19, 2013
Messages
16,635
Sorry, No - you won't learn anything. You've asked a question, I've answered it based on the limited information provided.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 09:50
Joined
May 7, 2009
Messages
19,246
y
Thank you very much. I am trying use replace function with bound textbox AFTERUPDATE event.
you can't replace it since the return value of dlookup is a string and PgID on your table is Numeric.
 

Attachments

  • Database7.accdb
    704 KB · Views: 59

smtazulislam

Member
Local time
Today, 04:50
Joined
Mar 27, 2020
Messages
806
Sorry, No - you won't learn anything. You've asked a question, I've answered it based on the limited information provided.
Before you have a comment, you have to open the dB that based on your suggest I have tried or Not.
I told you, I tried it Bound and Unbound textbox POST#10.
 

Users who are viewing this thread

Top Bottom