Default Value

  • Thread starter Thread starter ftpearce
  • Start date Start date
F

ftpearce

Guest
Hi can anyone help I'm building a form to add data if I add say 8659 for my first field I want my second field to be <IMG SRC="%%URLofImages%%/8659.jpg" BORDER=0> on my next record if I add say 9535 for my first field then my second field will read <IMG SRC="%%URLofImages%%/9535.jpg" BORDER=0> with 9535 to be the only variable and the rest always constant I've tried various ways but no seem to work can anyone help please.
 
Heres one way to do this:
All you have to do is place an afterupdate event in the first box where the code reads as follows: (Note that I refer to 'fieldin' as the field where you type the number, and 'fieldout' as the <IMG SRC="%%URLofImages%%/8659.jpg" BORDER=0> textbox)

Code:
Dim NumberToAdd As Integer

NumberToAdd = fieldin.Text
fieldout.SetFocus
fieldout.Value = "<IMG SRC=""" & "%%URLofImages%%/" & NumberToAdd & ".jpg""" & " BORDER=0>"

This should work well for your purposes. Just a note, the """ is just used in order to place a quote in a string without it terminating the string in code.

Ta

Jason
 
Thanks Jason that did the trick i've been blindly messin for days.

Cheers Mate for your time.


Paul :)
 
Hi
Ive followed Jasons instructions above and they work great except it my number is above 4 digits then I get a runtime error 6 have I done something wrong ?

Paul :mad:
 
The error occurs whit values above ca 30000. To solve the problem, change 'Integer' in the first line of code into 'Long' (Dim NumberToAdd As Long)
 

Users who are viewing this thread

Back
Top Bottom