God this is hard to learn for an old bloke

I now have another problem, in the following code, it is coming up “OutOfBoundsException” the code is to update a record set, I use a Popupmenu to select the recordset.

save(popupmenu1.RowTag(popupmenu1.ListIndex)) *** OutOfBoundsException in this line.

The save method is as follows,

[quote] Dim dr as new DatabaseRecord
dim rs as recordset = golfer.SQLSelect("select * from course where PK = "+ str(coursepk))

rs.Edit
rs.field(“club”).StringValue = trim( club.text)
rs.field(“clubaddress”).StringValue = trim(clubaddress.text)
rs.field(“proshop”).StringValue = trim(proshop.text)
rs.field(“clubphone”).StringValue = trim(clubphone.text)
rs.field(“par1”) .StringValue= trim(par1.text)
rs.field(“par2”).StringValue = trim(par2.text)
rs.field(“par3”).StringValue = trim(par3.text)
rs.field(“par4”).StringValue = trim(par4.text)
rs.field(“par5”).StringValue = trim(par5.text)
rs.field(“par6”).StringValue = trim(par6.text)
rs.field(“par7”).StringValue = trim(par7.text)
rs.field(“par8”).StringValue = trim(par8.text)
rs.field(“par9”).StringValue = trim(par9.text)
rs.field(“par10”).StringValue = trim(par10.text)
rs.field(“par11”).StringValue = trim(par11.text)
rs.field(“par12”).StringValue = trim(par12.text)
rs.field(“par13”).StringValue = trim(par13.text)
rs.field(“par14”).StringValue = trim(par14.text)
rs.field(“par15”).StringValue = trim(par15.text)
rs.field(“par16”).StringValue = trim(par16.text)
rs.field(“par17”).StringValue = trim(par17.text)
rs.field(“par18”).StringValue = trim(par18.text)
rs.field(“parfront”).StringValue = trim(parfront.text)
rs.field(“parback”).StringValue = trim(parback.text)
rs.field(“partotal”).StringValue = trim(partotal.text)

rs.update

app.golfer.commit

msgbox"Record has been Updated"[/quote]

Thanks Shane

May have fixed it ?

Since you don’t check for listIndex = -1 I would guess its that condition which s causing your OOB.

Right. If you don’t have anything selected in the popup, ListIndex will be -1, which is out of bounds. Change your code to

if popupmenu1.ListIndex>= 0 then
   save(popupmenu1.RowTag(popupmenu1.ListIndex))
end if

Hi Tim, I went back over the code and had a bit missing, the old eye’s aren’t what they used to be.

Cheers Shane.

Also thanks to Roger, I have to learn how to implement error checking.

The learning is the easy part. It’s the remembering part that dificult.

Wish me happy birthday!

Monday, July 14 will be 83.

[quote=110335:@Jim Smith]The learning is the easy part. It’s the remembering part that dificult.

Wish me happy birthday!

Monday, July 14 will be 83.[/quote]

Congratulations Jim :slight_smile:

Happy Birthday Jimbo ! :slight_smile:

[quote=110335:@Jim Smith]The learning is the easy part. It’s the remembering part that dificult.

Wish me happy birthday!

Monday, July 14 will be 83.[/quote]
Cool. How long have you been programming for, out of interest?

[quote=110335:@Jim Smith]The learning is the easy part. It’s the remembering part that dificult.

Wish me happy birthday!

Monday, July 14 will be 83.[/quote]
And congrats.

[quote=110335:@Jim Smith]The learning is the easy part. It’s the remembering part that dificult.

Wish me happy birthday!

Monday, July 14 will be 83.[/quote]
I see you are retired.

Happy Birthday for Monday Jim, have a good one.

Yay! Someone older than me!

About 1963. IBM 1401.

Wow. Definitely not a desktop. There’s nothing like oxygen masks on the walls to give you a sense of gravitas…

Happy Birthday in advance. :slight_smile:

well nothing really changed since 1968 when you follow this presentation :wink:

https://www.youtube.com/watch?v=VScVgXM7lQQ&list=PL76DBC8D6718B8FD3&index=1

The screens are just bigger, everything’s more fancy, everywhere more eye candy :wink:

[quote=110654:@Tanner Lee]Wow. Definitely not a desktop. There’s nothing like oxygen masks on the walls to give you a sense of gravitas…

Happy Birthday in advance. :)[/quote]

Where are the the gas masks??

Wow. You must have a lot of experience.

Yes. One years experience time 27.