Hi,
Once again I find myself struggling with the VB6-code.
This is the situation:
I've got 2 dropdowns (both comboboxes style: 2 - Dropdown List). 1 lists the zip codes, the other the locations.
Whichever of those 2 gets a clickevent first will trigger the other to limit the possibilities to those that match. (so, when you choose a zip-code, the other dropdown will only show the matching locations. On the other hand, if you choose a location, the zip-dropdown will only show the matching zip-code.) This part works like a charm and I'm quite happy with the result I got here.
The problem starts with the 'update' function I need in that screen. This stuff is all part of the customer-data screen and as you know, customers may choose to move. Thus... it has to be able to represent this in the db that runs in the back. Again no problem there, but when you start to edit and you happen to change either the zip and/or the location and suddenly don't want to go through with the edit things go bad.
Upon pushing the cancel button, I restore the whole screen to the previous values, but the location-dropdown gives me a 383 error saying the combobox is read-only.
I -know- that's what I told it to be, but I would still like to get the old value in there when pushing cancel.
Anybody got some ideas?
Once again I find myself struggling with the VB6-code.
This is the situation:
I've got 2 dropdowns (both comboboxes style: 2 - Dropdown List). 1 lists the zip codes, the other the locations.
Whichever of those 2 gets a clickevent first will trigger the other to limit the possibilities to those that match. (so, when you choose a zip-code, the other dropdown will only show the matching locations. On the other hand, if you choose a location, the zip-dropdown will only show the matching zip-code.) This part works like a charm and I'm quite happy with the result I got here.
The problem starts with the 'update' function I need in that screen. This stuff is all part of the customer-data screen and as you know, customers may choose to move. Thus... it has to be able to represent this in the db that runs in the back. Again no problem there, but when you start to edit and you happen to change either the zip and/or the location and suddenly don't want to go through with the edit things go bad.
Upon pushing the cancel button, I restore the whole screen to the previous values, but the location-dropdown gives me a 383 error saying the combobox is read-only.
I -know- that's what I told it to be, but I would still like to get the old value in there when pushing cancel.
Anybody got some ideas?
Code:
Public Sub FillAdresScreen(ByVal state As eEmptyFields)
With <myForm>
If state Then
.txtStreet.Text = ""
.cmbZip.Text = ""
.cmbLocation.Text = ""
Else
On Error GoTo ErrorHandling
.txtStreet = thisAbo.strStreet
.cmbZip.Text = thisAbo.intZip 'zip is a 4-digit code
.cmbLocation.Text = thisAbo.strLocation
End If
End With
Exit Sub
ErrorHandling:
With frmDvmMain
Select Case Err.Number
Case 383
MsgBox "error occured"
.cmbLocation.Text = thisAbo.strLocation
End Select
End With
Resume Next
End Sub
-> thisAbo is a TYPE set up the same way as a DB record and it holds the data of the 'current customer'.
-> state is a boolean variable telling the code to blank the screen or restore the data from the 'current customer'.