The terms C++, form, Access and database suggest some assumptions that were not mentioned as requirements. However, there are actually countless possibilities of what could be meant and how something like this could be realized. Of course, if you don't specify it, you won't find anything specific with Google.
To create a database application in C++ under Windows, you could proceed as follows.
1. create a Win32 C++ desktop project with Visual Studio or another development environment. In Visual Studio, the wizard usually creates a GUI based on the Windows API.
2. define the GUI controls, for example for input fields:
struct EmployeeControls {
HWND hEmployeeID, hFirstName, hLastName, hOpenEmergencyContactsButton;
} controls;
3. define further data structures, such as
class Employee {
public:
Employee() : autoID(0) {} int manageAutoID(int value = 0); std::wstring manageEmployeeID(const std::wstring& value = L"");
std::wstring manageFirstName(const std::wstring& value = L"");
std::wstring manageLastName(const std::wstring& value = L"");
bool LoadFromDatabase(sqlite3* db, int autoID);
private:
int autoID;
std::wstring employeeID;
std::wstring firstName;
std::wstring lastName;
};
4. display the employee form in the main window and offer the possibility to open the emergency contact form.
5. download the SQL database engine www.sqlite.org and add it to the project
Usually enter paths and libraries in the project settings and integrate them with include headers.
6. create/open the SQLite database with C++.
7. create tables for employees and employee emergency contacts in the database using C++.
To make something visible right at the beginning of step 4, you could use the following, for example:
void AddControls(HWND hWnd) {
CreateWindowW(L"static", L"Employee ID:", WS_VISIBLE | WS_CHILD, 50, 50, 100, 25, hWnd, NULL, NULL, NULL);
controls.hEmployeeID = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILD | WS_BORDER, 150, 50, 200, 25, hWnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"First Name:", WS_VISIBLE | WS_CHILD, 50, 100, 100, 25, hWnd, NULL, NULL, NULL);
controls.hFirstName = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILD | WS_BORDER, 150, 100, 200, 25, hWnd, NULL, NULL, NULL);
CreateWindowW(L"static", L"Last Name:", WS_VISIBLE | WS_CHILD, 50, 150, 100, 25, hWnd, NULL, NULL, NULL);
controls.hLastName = CreateWindowW(L"edit", L"", WS_VISIBLE | WS_CHILD | WS_BORDER, 150, 150, 200, 25, hWnd, NULL, NULL, NULL);
controls.hOpenEmergencyContactsButton = CreateWindowW(L"button", L"Open Emergency Contacts", WS_VISIBLE | WS_CHILD, 50, 200, 200, 25, hWnd, (HMENU)1, NULL, NULL);
}
The function can then be used in WindowProcedure (WinProc):
LRESULT CALLBACK WindowProcedure(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) {
switch (msg) {
WM_CREATE:
AddControls(hWnd);
break;