mcclunyboy
Registered User.
- Local time
- Today, 15:05
- Joined
- Sep 8, 2009
- Messages
- 292
Hi,
I have a database in Access97 which works mostly fine. However we have recently upgraded to Access 2007. Most of the database is fine, we had to remove some old VB references and code but for a few months got no reports of any issues.
However we have now discovered 2 things.
Firstly we have a form which has 2 drop down menus and a number of text boxes. The first drop down menu selects a department and the second an individual from within that department, once selected it populates the text box (code below)
For some reason the textboxes are not being populated with the details (this did work in access 97). Anyone know why or suggest a solution?
Secondly, we used to add a button to the toolbar in Access 97 which allowed the user to select "edit" or "add" mode on a form, the code is below, is there any alternative to this in Access 97.
I have a database in Access97 which works mostly fine. However we have recently upgraded to Access 2007. Most of the database is fine, we had to remove some old VB references and code but for a few months got no reports of any issues.
However we have now discovered 2 things.
Firstly we have a form which has 2 drop down menus and a number of text boxes. The first drop down menu selects a department and the second an individual from within that department, once selected it populates the text box (code below)
Code:
[SIZE=2]Private Sub SelectUser_AfterUpdate()[/SIZE]
[SIZE=2] ' Find record for user selected in SelectUser combo box.[/SIZE]
[SIZE=2] ' Enable controls in detail section and disable UserID text box.[/SIZE]
[SIZE=2] ' Go to Type combo box.[/SIZE]
[SIZE=2] DoCmd.ApplyFilter , "UserID = Forms!frmLimitEditUsers!SelectUser"[/SIZE]
[SIZE=2] EnableControls Me, acDetail, True[/SIZE]
[SIZE=2] Me!UserID.Enabled = False[/SIZE]
[SIZE=2] Me!Type.SetFocus[/SIZE]
For some reason the textboxes are not being populated with the details (this did work in access 97). Anyone know why or suggest a solution?
Secondly, we used to add a button to the toolbar in Access 97 which allowed the user to select "edit" or "add" mode on a form, the code is below, is there any alternative to this in Access 97.
Code:
[SIZE=2]Function EditData() As Integer[/SIZE]
[SIZE=2] ' Code for Edit Data button on EnterOrEditUsers1 toolbar.[/SIZE]
[SIZE=2] Dim frm As Form[/SIZE]
[SIZE=2] Dim ctlCombo1 As Control[/SIZE]
[SIZE=2] Dim ctlCombo2 As Control[/SIZE]
[SIZE=2] Dim ctlCombo3 As Control[/SIZE]
[SIZE=2] On Error GoTo EditData_Err[/SIZE]
[SIZE=2] Set frm = Forms!frmEditUsers[/SIZE]
[SIZE=2] Set ctlCombo1 = Forms!frmEditUsers!SelectBusiness[/SIZE]
[SIZE=2] Set ctlCombo2 = Forms!frmEditUsers!SelectSection[/SIZE]
[SIZE=2] Set ctlCombo3 = Forms!frmEditUsers!SelectUser[/SIZE]
[SIZE=2] ' Set AllowEdits property to True to indicate Edit mode.[/SIZE]
[SIZE=2] frm.AllowEdits = True[/SIZE]
[SIZE=2] ' Switch toolbars.[/SIZE]
[SIZE=2] DoCmd.ShowToolbar "EnterOrEditUsers1", acToolbarYes[/SIZE]
[SIZE=2] DoCmd.ShowToolbar "EnterOrEditUsers2", acToolbarNo[/SIZE]
[SIZE=2] ' Enable and move to first combo box.[/SIZE]
[SIZE=2] ctlCombo1.Enabled = True[/SIZE]
[SIZE=2] ctlCombo1.SetFocus[/SIZE]
[SIZE=2] ' Disable controls in detail section.[/SIZE]
[SIZE=2] EnableControls frm, acDetail, False[/SIZE]
[SIZE=2] Exit Function[/SIZE]
[SIZE=2]EditData_Err:[/SIZE]
[SIZE=2] MsgBox Err.Description[/SIZE]
[SIZE=2] Exit Function[/SIZE]
[SIZE=2]
[/SIZE]