I am really hoping someone can help me. I am a complete noob to VB 2008 though I have worked with MS Access, VBA and VB for 15 years.
I have been asked to write a system for employee to enter expenses. I’ve setup 2 tables in SQL, first the ExpenseHdr for employee, date etc… then ExpenseLines for the expense items to be added. I’ve setup primary Keys and a cascade update delete relationship between the ExpenseID which is stored in both tables.
I used the data sources tab and was able to create a Parent and Child grid and have them working perfectly!
Here’s the kicker. When they enter their Employee ID number into the employee ID box, I need VB 2008 to check if they have an open expense ticket and load it in the form. We cannot allow the user to browse through all of the other employees expenses so I have deleted the browse buttons.
To fix this, I edited the table adapter’s fill and GetData method with EmployeeID = @EmployeeID, however, when I load the form I receive the error: Argument not specified for parameter 'EmployeeID' of 'Public Overridable Overloads. It’s obvious why I’m getting the error because I can’t figure out how to set @EmployeeID in code. I could do this so easily in Access and VB but it seems illogical .NET. I am almost of the opinion that I should hand code the data management.
I also have a second problem. When the user clicks new record, they are given an Auto Increment Expense ID number by VB. This is being picked up from the Expense ID field in the database. The problem is that it’s not the real ID the ticket will be assigned when it is saved. If another user saves a record first, they will steal the ID number and the first user’s ID number will be changed when the save button is pressed. That is poor! I understand why it occurs but VB should prevent it. You cant issue an ID number to a user and then change it later. Do I need to create a blank record in the DB first and then UPDATE the data back to the DB?
I almost wish I had no programming knowledge because I am stuck in an MS Access and VB mindset and are having problems scaling back the things I used to be able to easily program. Someone please help me.
I have been asked to write a system for employee to enter expenses. I’ve setup 2 tables in SQL, first the ExpenseHdr for employee, date etc… then ExpenseLines for the expense items to be added. I’ve setup primary Keys and a cascade update delete relationship between the ExpenseID which is stored in both tables.
I used the data sources tab and was able to create a Parent and Child grid and have them working perfectly!
Here’s the kicker. When they enter their Employee ID number into the employee ID box, I need VB 2008 to check if they have an open expense ticket and load it in the form. We cannot allow the user to browse through all of the other employees expenses so I have deleted the browse buttons.
To fix this, I edited the table adapter’s fill and GetData method with EmployeeID = @EmployeeID, however, when I load the form I receive the error: Argument not specified for parameter 'EmployeeID' of 'Public Overridable Overloads. It’s obvious why I’m getting the error because I can’t figure out how to set @EmployeeID in code. I could do this so easily in Access and VB but it seems illogical .NET. I am almost of the opinion that I should hand code the data management.
I also have a second problem. When the user clicks new record, they are given an Auto Increment Expense ID number by VB. This is being picked up from the Expense ID field in the database. The problem is that it’s not the real ID the ticket will be assigned when it is saved. If another user saves a record first, they will steal the ID number and the first user’s ID number will be changed when the save button is pressed. That is poor! I understand why it occurs but VB should prevent it. You cant issue an ID number to a user and then change it later. Do I need to create a blank record in the DB first and then UPDATE the data back to the DB?
I almost wish I had no programming knowledge because I am stuck in an MS Access and VB mindset and are having problems scaling back the things I used to be able to easily program. Someone please help me.