accessvbahelp
Technical User
I am very new at writing VBA code and I can't figure out why this is not working. When the approve button is clicked the revision letter that is in the main table needs to index by one. The revision letter must always be letters. I have a seperate table in Access called TblRev that references a number to the correct revision letter (example 1=A, 2=B,... 27=AA, 28=AB, etc)the column with the numbers is called Number and the column with the letters is called Revision. I am trying to do a DLookup to reference the table but I can't get it to work. This is what I have so far.
Please be patient with me I a very new at writing code.
Thank you all for your help.
Code:
'This section also updates the revision status from "AREV" to "B" as an example.
Dim strNewRev As String
Dim NewRevAlpha As Integer
'Updates revision letter
Rev = Forms("frmMain")!Revision.Value 'Gets revision letter from form
NewRev = Revision 'Defines the revision code for the drawing under revision
Me.AllowEdits = True 'Allows the data to be edited
NewRev = DLookup("Number", "tblRev", "Revision")
NewRev = NewRev + 1 'Indexes the alpha by one
NewRev = DLookup("Revision", "tblRev", "Number")
Me!Revision.Value = NewRev 'Places updated revision character in table
Me.AllowEdits = False 'Disables table edits
Me.Refresh 'Updates data in form and table
End Sub
Please be patient with me I a very new at writing code.
Thank you all for your help.