You could use something like this:
Private Function ConvertDate(intMonth as integer, intYear as integer) as String
Dim strNewDate as String * 4
Dim intNewMonth as Integer
Dim strNewMonth as String * 2
Dim intNewYear as Integer
Dim strNewYear as String * 2
Dim intNewDate as Integer
If intMonth < 10 then
intNewMonth = intMonth + 3
intNewYear = intYear
else
intNewMonth = intMonth - 9
intNewYear = intYear + 1
End If
strNewMonth = cstr(intNewMonth)
strNewYear = cstr(intNewYear)
strNewDate = strNewYear & strNewDate
ConvertDate = strNewDate
End Sub
Joe Chin - Using to textboxes and formulas
Thanks for the code but as I have had no training on this some of the code makes absolutley no sense to me sometimes but i try. I am not sure exactly how this would work and it seems to me that i should have code for the textbox which would register the end result. Am I right or am I up a creek without a paddle.
Beverley
Re: Joe Chin - Using to textboxes and formulas
You're up a creek, but I am the paddle . . .
The code I gave you is a function that accepts 2 arguments (intMonth and intYear) and returns a string. Once again, I haven't tested this, but basically, this is how you would call it if you have 3 text boxes: txtMonth, txtYear, and txtYearMonth (which provides the result). I'll create a command button called cmdButton so you have an event to tie it to.
Private Sub cmdButton_Click()
txtYearMonth.Text = ConvertDate(txtMonth.Text,txtYear.Text)
End Sub
This sub plugs the month and year (from the textboxes) into the ConvertDate function. The ConvertDate function does its magic, then answers with the converted date as a string. The string then gets passed into the text for txtYearMonth.
Re: Joe Chin - Using to textboxes and formulas
Joe,
My problem now, is that this is a form for an overseas user and my boss wants it has only the controls that apply to them. Therefore the command button is not going to work in this instance. Can't the convert function be called after the data is punched into txtYear and the textbox loses focus. This is just an idea. Am I making any sense??
Beverley