michaelleewebb
Member
been writing in vba (msaccess) for over 20 years, i have a "style" i like to use. can someone point me to a class ? lib ? sql lib ? that would allow be to continue using something like the same style? below is an example of me using my style to "edit","delete" or update a record , i'm looking at b4xtable at the moment.
B4X:
'EDIT RECORD
Set MyDB = OpenDatabase(Mydatabase)
Set MyTable = MyDB.OpenRecordset("citytbl", DB_OPEN_TABLE)
MyTable.MoveFirst ' Locate first record.
Do Until MyTable.EOF ' Begin loop.
If MyTable!Zip = Val(Me.Combobox45) Then
MyTable.edit
MyTable!City = "NewYork"
MyTable.Update
Exit Do
End If
MyTable.MoveNext ' Locate next record.
Loop ' End of loop.
MyTable.Close ' Close table.
MyDB.Close 'close database
'DELETE RECORD
Set MyDB = OpenDatabase(Mydatabase)
Set MyTable = MyDB.OpenRecordset("citytbl", DB_OPEN_TABLE)
MyTable.MoveFirst ' Locate first record.
Do Until MyTable.EOF ' Begin loop.
If MyTable!Zip = Val(Me!Combo599) Then
MyTable.Delete
End If
MyTable.MoveNext ' Locate next record.
Loop ' End of loop.
MyTable.Close ' Close table.
MyDB.Close 'close database
'ADD RECORD
Set MyDB = OpenDatabase(Mydatabase)
Set MyTable = MyDB.OpenRecordset("citytbl", DB_OPEN_TABLE)
dim MatchFound as bool = False
MyTable.MoveFirst ' Locate first record.
Do Until MyTable.EOF ' Begin loop.
If MyTable!Zip = Val(Me!Combo599) Then
MatchFound = True
Exit Do
End If
MyTable.MoveNext ' Locate next record.
Loop ' End of loop.
if Matchfound = False then
mytable.Add
mytable!City = "New York"
mytable!zip = "1111113"
mytable.UpDate
End if
MyTable.Close ' Close table.
MyDB.Close 'close database