Run-Time error '2424':

N

Nmidia

Hi All,

I am at the point of despair with this one!

I have a form which can be opened in either update or addnew mode. the
form links to the main table. On the form is a subform that contains
address data. When opened in update mode everything works fine.
However, when I open the form in addnew record mode, i get "runtime
error 2424; The expression you entered has a field, control, or propery
name that .....database can't find."


This error is occuring on the subform on the following line of code;
------------------
strSQL = "Select * from tbl_Address where [customername] = '" &
Me.cmbCustomerName & "'"
-----------------------
in the following block;


---------------------------------------
Private Sub GetBillingAddress()
Dim dbDatabase As Database
Dim rsRecordset As Recordset
Dim strSQL As String
Dim Response As Integer
Dim gContactName As String


If Not IsNull(Me.cmbCustomerName) Then
Set dbDatabase = CurrentDb
strSQL = "Select * from tbl_Address where customername = '" &
Me.cmbCustomerName & "'"
Set rsRecordset = dbDatabase.OpenRecordset(strSQL)
If rsRecordset.RecordCount > 0 Then
Me.cmbCustomerName = rsRecordset.Fields("customername")
Me.txtContactName = rsRecordset.Fields("contact")
Me.txtCUstomerReferenceNumber =
rsRecordset.Fields("customerref")
Me.txtBaddline1 = rsRecordset.Fields("baddline1")
Me.txtBaddline2 = rsRecordset.Fields("baddline2")
Me.txtBaddline3 = rsRecordset.Fields("baddline3")
Me.txtBadDline4 = rsRecordset.Fields("baddline4")
Me.txtBaddline5 = rsRecordset.Fields("baddline5")
Me.txtPhone = rsRecordset.Fields("phone")
Me.txtFax = rsRecordset.Fields("fax")
Me.txtEmail = rsRecordset.Fields("email")
Me.chkDVDCustomer = rsRecordset.Fields("DVDCustomer")

End If
rsRecordset.Close
Else
MsgBox "You must enter a Company Name", vbCritical, "Find
Billing Address"
End If
End Sub

------------------------------------------------------------------


this has only recently begun to happen, and i have no idea why. I was
also able to fix it before by importing a copy of the subform. This
has also now stopped fixing it.

The code looks up the address fields from tbl_address to try and
autofill the fields. If a record exisits in the database with the
customername the system will autofill the address fields.

any help is appreciated! if you need more info please ask! Its
driving me insane!
 
N

Nmidia

sorry, think I have fixed it! The subform was set to allowadditions -
no. I guess when it was trying to switch modes it was getting very
confused!

lets play spot the monkey coder------yes, its me!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top