Solved Runtime error 3071 (1 Viewer)

chrisjames25

Registered User.
Local time
Today, 19:28
Joined
Dec 1, 2014
Messages
401
Hoping you guys can help. Currently pulling hair out as last 4 hours of work has suddnely glitched (ive done something) and i dont know how to fix it.

I have a form (image attached) I choose from a supplier from a combobox and based on the supplier chosen a list of sales orders is populated in a sales order combobox. ONce i have selected the sales order i want to edit i click eidt sales order. THis refreshes the record source qry based on the slection in the sales order cbo. IMage attached.

All works fine and then the rest of the form is populated. info on the right of screen is all bound data and info in the amend sales order info section is unbound. I alter anythign i want in the amend sales order info section. I then click edit and it amends the data and then resets the form using the following code:

Code:
        Application.Echo False
             ApplyData
             ResetForm
            
           Me.Form.Requery

The reset form part of the code is here:

Code:
Sub ResetForm()
    
    'DATA
    
    Me.Cbo_Supplier2.Value = vbNullString
    Me.Cbo_Supplier2.Enabled = False
    
    Me.Txt_WeekNo.Value = vbNullString
    Me.Txt_WeekNo.Enabled = False
    
    Me.Cbo_Nursery.Value = vbNullString
    Me.Cbo_Nursery.Enabled = False
    
    Me.Txt_SalesOrderNo.Value = vbNullString
    Me.Txt_SalesOrderNo.Enabled = False
    
    'CMD BUTTONS
    
    Me.Cmd_Cancel.Enabled = False
    Me.Cmd_Edit.Enabled = False
   ' Me.Cmd_Close.Enabled = True
  
  '  Me.Txt_SalesOrderID.Value = vbNullString
  '  Me.Form.RecordSource = "Qry_SalesOrderEdit1"
    
    '#######################
    'TOP INFO
    
    
    Me.Cbo_Supplier.Enabled = True
    Me.Cbo_Supplier.Value = vbNullString
    
    Me.Cbo_SalesOrderNo.Requery
    Me.Cbo_SalesOrderNo.Value = vbNullString
    
    Me.Cmd_Close.Enabled = True
    Me.Cmd_EditSalesOrder.Enabled = True
    
    
  
    
End Sub

Earlier tonight this code worked fine but now i get an error code runtime error 3071 appear and the bound data just populates with Name?.

I have no clue what has changed. ANy help would be greatly appreciated.
 

Attachments

  • FOrm when opened.JPG
    FOrm when opened.JPG
    54.2 KB · Views: 32
  • Form with data populated.JPG
    Form with data populated.JPG
    54.8 KB · Views: 25
  • Record Source for form.JPG
    Record Source for form.JPG
    55.5 KB · Views: 28
  • Runtime error.JPG
    Runtime error.JPG
    77.6 KB · Views: 32

chrisjames25

Registered User.
Local time
Today, 19:28
Joined
Dec 1, 2014
Messages
401
Apologies it seems to error on the form.requery part of the code
 

Gasman

Enthusiastic Amateur
Local time
Today, 19:28
Joined
Sep 21, 2011
Messages
14,310
No idea what 3071 is. :(
I normally use Me.Requery for a form, or the recordsource if I do not want the record pointer to move.
 

isladogs

MVP / VIP
Local time
Today, 19:28
Joined
Jan 14, 2017
Messages
18,227
?AccessError(3071)
This expression is typed incorrectly, or it is too complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 13:28
Joined
Feb 28, 2001
Messages
27,188
This expression is typed incorrectly, or it is too complex to be evaluated...

We just had another thread with that same kind of error and it was due to a buggy patch, I believe. Colin, you were involved in that buggy patch and the fix. Do you think the patch problem could apply here?
 

isladogs

MVP / VIP
Local time
Today, 19:28
Joined
Jan 14, 2017
Messages
18,227
Seeing #Name? normally indicates a typo or that something has been renamed e.g. the form filter criteria
There's nothing obvious here that suggests a bug. Can you remind me of the thread in case I'm missing something.
 
Last edited:

chrisjames25

Registered User.
Local time
Today, 19:28
Joined
Dec 1, 2014
Messages
401
Found my problem. PHew. Sometimes best to step away from it for a day and then the issue is easier ot find.

Basically the query builder i posted was wrong. I should have been referencing a txt box instead of a combobox. When i made the change i still got the same error because in the resetform part of the code I was changing the text box to vbnullstring. As soon as i changed that to a value of 1 the form reset correct.

Thanks for your help everyone.
 

Users who are viewing this thread

Top Bottom