markedback
MIS
I have a form I use to monitor the entries in a table. The form is based on a simple select query which based on just one table. The table has fields like salespersonID, salespersonName, custAcctNum, custName, orderID, date, time.
Whenever their is a blank cell, I use dlookup through a button on the form to
populate the corresponding data. For example if the salespersonName is missing from a record, I use a dlookup on another table with a list of salespersons to populate the salesperson's name by his/her ID.
---------------------------------------
Private Sub salesperson_name_Click()
On Error GoTo Err_salesperson_name_Click
Dim strsalespersonID As String
Dim strsalespersonName As String
If Forms!OrderCheck!salespersonName = "" Then
strsalespersonName = Nz(DLookup("[salespersonName]", "salespersonList", "[salespersonID] = '" & Me![salespersonID] & "'"))
Me.salespersonName = strsalespersonName
End If
Exit_salesperson_name_Click:
Exit Sub
Err_salesperson_name_Click:
MsgBox Err.Description
Resume Exit_salesperson_name_Click
End Sub
----------------------------------------------------------
The button worked initially but then stopped working.
I am confused as to why this is happening. Could this be happening because the fields on the form are 'bound' to the query and this prevents data editing?
Please suggest a solution.
Thanks
Mark.
Whenever their is a blank cell, I use dlookup through a button on the form to
populate the corresponding data. For example if the salespersonName is missing from a record, I use a dlookup on another table with a list of salespersons to populate the salesperson's name by his/her ID.
---------------------------------------
Private Sub salesperson_name_Click()
On Error GoTo Err_salesperson_name_Click
Dim strsalespersonID As String
Dim strsalespersonName As String
If Forms!OrderCheck!salespersonName = "" Then
strsalespersonName = Nz(DLookup("[salespersonName]", "salespersonList", "[salespersonID] = '" & Me![salespersonID] & "'"))
Me.salespersonName = strsalespersonName
End If
Exit_salesperson_name_Click:
Exit Sub
Err_salesperson_name_Click:
MsgBox Err.Description
Resume Exit_salesperson_name_Click
End Sub
----------------------------------------------------------
The button worked initially but then stopped working.
I am confused as to why this is happening. Could this be happening because the fields on the form are 'bound' to the query and this prevents data editing?
Please suggest a solution.
Thanks
Mark.