To speed up typing the data

  • Thread starter Thread starter Frank Situmorang
  • Start date Start date
F

Frank Situmorang

Hello,

I have a form to update member's photo using imagepath to store the images
on the form I have a textbox to type the path of the photo like this:
C:\Private\churchdata\frank.jpg

Instead of typing too long, how can we have the system type upto
C:\Private\churchdata\
and the church clerck only type "frank.jpg" and when we enter or move to the
next field the system will fill in as complete as
C:\Private\churchdata\frank.jpg
Sorry I do not know how to say it in English, sincen we seldom speak English
in Jakarta.

Thanks in advance
 
Yes you can do this.
Just assign the string to the control, then use .SELSTART to set the cursor
e.g

Me!myControl = "C:\Myfolder\myfile.txt
Me!myControl.selstart = len(Me!myControl)+1

-Dorian
 
Hi -

One way is to use the after update event of the text box to add the first
part. In the After Update event of the textbox, put this code, replacing
MyTextBox with the name of the text box on your form:

me!MyTextBox = "C:\Private\churchdata\" & me![myTextBox]

This way the clerk only needs to type "frank.jpg" (no quotes) in to the
textbox, and the rest will be added automatically.

Note that if the clerk makes a mistake with the file name and fixes it
without deleting all the text first, then "C:\Private\churchdata\" will be
added a second time.

John
 
Thanks Goddard for your help, it works for selftyping the words, but why my
VBA does not work for no picure, in the folder I have an emty image that I
created with text on it saying "Nopicrure" just to remind that the member
should have his;her picture.

this is my VBA:
Private Sub Form_Current()
On Error Resume Next
If Not (IsNull(Me.ImagePath)) Then
Me.ImageFrame.Picture = Me.ImagePath
Else
Me.ImageFrame.Picture = "C:\Private\Churchdata\Nopicture.jpg"
End If
End Sub

Private Sub ImagePath_AfterUpdate()
On Error Resume Next
Me!ImagePath = "C:\Private\churchdata\" & Me![ImagePath]
If Not (IsNull(Me.ImagePath)) Then
Me.ImageFrame.Picture = Me.ImagePath
End If
End Sub
--
H. Frank Situmorang


J_Goddard via AccessMonster.com said:
Hi -

One way is to use the after update event of the text box to add the first
part. In the After Update event of the textbox, put this code, replacing
MyTextBox with the name of the text box on your form:

me!MyTextBox = "C:\Private\churchdata\" & me![myTextBox]

This way the clerk only needs to type "frank.jpg" (no quotes) in to the
textbox, and the rest will be added automatically.

Note that if the clerk makes a mistake with the file name and fixes it
without deleting all the text first, then "C:\Private\churchdata\" will be
added a second time.

John


Frank said:
Hello,

I have a form to update member's photo using imagepath to store the images
on the form I have a textbox to type the path of the photo like this:
C:\Private\churchdata\frank.jpg

Instead of typing too long, how can we have the system type upto
C:\Private\churchdata\
and the church clerck only type "frank.jpg" and when we enter or move to the
next field the system will fill in as complete as
C:\Private\churchdata\frank.jpg
Sorry I do not know how to say it in English, sincen we seldom speak English
in Jakarta.

Thanks in advance
 
Back
Top