I'm fairly new to access and VB. I have a form which contains several
text boxes and an insert record command button. The button is supposed
to insert a new record into the database using the text fields, and
then increment a text field by 1. The insert record part works fine,
but I cannot seem to increment a text box by one. I'm sure theres a
simple explination to this!! Here is the code behind the command
button.
Private Sub cmdInsertRecord_Click()
Dim conDatabase As ADODB.Connection
Dim strSQL As String
Set conDatabase = CurrentProject.Connection
strSQL = "INSERT INTO PHOTOSAccess (REF) VALUES (" & lblRef & ")"
conDatabase.Execute strSQL
conDatabase.Close
Set conDatabase = Nothing
[Forms]![enterRecord]![lblRef] = [Forms]![enterRecord]![lblRef] + 1
End Sub
Its the last statment i cannot get right, any ideas? The text box I
want to increment is called 'lblRef' and is on a form called
'enterRecord'.
many thanks
jon.