简体   繁体   English

MySql访问VB

[英]MySql Access VB

My application is
Microsoft Access front end
MySql back end
Code is in vb

I am trying to modify a form that has a few drop down fields [![enter image description here][1]][1]. 我正在尝试修改具有几个下拉字段的表单[![在此处输入图像描述] [1]] [1]。 I need it to require the jobcustomerID before updating. 我需要它在更新之前需要jobcustomerID Right now if i add an address first it will tell me to add the customer but gives me an error for "invalid use of null" 现在,如果我先添加地址,它将告诉我添加客户,但会给我一个错误,提示“无效使用null”

Current Code 当前代码

    Private Sub Form_BeforeUpdate(Cancel As Integer)
       If IsNull(Me.JobCustomerID) Or Me.JobCustomerID = "" Then
            Call MsgBox("You must select a Customer from the list provided", vbExclamation, "REQUIRED ENTRY")
             Me.JobCustomerID.SetFocus
             Cancel = True
             Exit Sub
           End If
       End Sub

I do have an image of the fields but lack the reputation needed 我确实有田野的照片,但缺乏所需的声誉

Try moving the cancellation to the front. 尝试将取消操作移到最前面。

If IsNull(Me.JobCustomerID) Or Me.JobCustomerID = "" Then
    Cancel = True
    MsgBox "You must select a Customer from the list provided", vbExclamation, "REQUIRED ENTRY"
    Me.JobCustomerID.SetFocus
    Exit Sub
End If

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM