Just a quick VB question –
I’m using VB6, and I just need to add an If…Then statement to prompt the user when they are overwritting a field previously populated in SQL. This will keep additional users from updating the field multiple times without knowing that I updated it already. I’m just unsure of the order of this belongs in. Previously, it was in this order:
- On button click, test connection to sql database, and update field userName with user1’s name if it is currently empty.
- close sql connection
After adding my If…Then, it’s something more like this:
- On button click, test connection, and update field userName with user1’s name IF it is empty.
- Once updated, update ‘updated’ boolean field(I added a field to keep track each time there is an sql update) to True.
- Added IF statement before End IF on first statement, stating that IF ‘updated’ = True, then display a YES/NO Msgbox prompting user2 to make a decision on whether or not they want to continue to update the userName field for the second time, and overwrite user1’s name, then End If.
- End If on the first updating statement.
- close sql connection.
End goal is to prevent user2 from overwriting user1’s update immediately without receiving some type of prompt that user1 has already updated it. I’m just not sure if my code should surround the initial updating IF..THEN, or be put inside or it where it initally checks if the field is empty. Any help would be great.
I would have provided the actual code, but it’s proprietary.
I think this is what you have in mind?