By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,399 Members | 1,319 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,399 IT Pros & Developers. It's quick & easy.

updating a text box in VB

P: n/a
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.

Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.