-
As I am a bit of a novice to VB I need help with the following problem. I have a form to add new members to my membership table in a database. The form contains text boxes that write to the table via a command button. One of the text boxes is for 'Membership Number'. I want this text box to automatically come up with the next available number when I open the form. I'm sure that this is a fairly simple question, but I am new to the subject!
-
dim rcdTable as recordset, dbsData as database
set dbsData = opendatabase("database.mdb")
set rcdtable = dbsdata.openrecordset("select MembreNumber from table")
rcdtable.movelast
if rcdtable("MemberNumber") <> "" then
txtmember.text = cint(rcdtable("MemberNumber")) + 1
else
txtmember.text = "1"
end if
rcdtable.close
dbsdata.close
Here you go, you have to change variable names etc but it works.