Lately I’ve been playing around with CDbl, but I’m unsure about something. If I’m not mistaken, CDbl can make a string look like an integer. I’m playing with some practice code. The program is a database where teams and players can be added. Before I add a new team into the database, I want to create a Team ID for them. While filling out the team information, the user can insert a team ID number manually or click a button to create an ID for them and it will appear in the team ID text field. Then the user clicks Save and it saves into the DB.
In the code below, I’ve Dim x As an Integer, however I’m not sure what extension I should add for the x so that the number appears in the text field. I’ve tried
x.integer = CDbl(teamIDfield.text) but I get an error. For fun I tried
x.text= CDbl(teamIDfield.text) it doesn’t work. For the textfield property, does the Super type (TextField vs TextArea) matter in this case?
P.S. Please excuse me if the code is wrong below. I haven’t been able to go further in playing with it because I can’t get past these errors mentioned above.
[code] Dim x As Integer
x = 50
If rs.Field(“id”).IntegerValue <> x Then
x = CDbl(teamIDfield.text)
Else x =x + 1 x = CDbl(teamIDfield.text) End If[/code]