我有一个小问题,我认为某人(显然比我聪明)可以帮助指导我。出于某种原因,我无法使其正常工作:
&安培; me.prepayment_month =“”
Prepayment_Month是所有月份的下拉列表。如果我输入一个月,并逐步执行代码,则会识别月份。我的问题是什么时候它是空白的。它没有意识到这种情况。我试过Null,“”,空白,并且都没有被认出来。
Private Sub Add_Prepayment_Save()
DoCmd.Save acForm, "frmInvoices"
If Me.Rec_d_Prepayment = 0 Then
DoCmd.Save acForm, "frmInvoices"
End If
If Me.Rec_d_Prepayment <> 0 & Me.prepayment_month = " " Then
MsgBox "Please Update Prepayment Month"
End If
If Me.Rec_d_Prepayment <> 0 & Me.prepayment_month <> "" Then
MsgBox "This will be added to tblPrePayment"
End If
End Sub
-------更新1 ---------
Private Sub Add_Prepayment_Save()
DoCmd.Save acForm, "frmInvoices"
If Me.Rec_d_Prepayment = 0 Then
DoCmd.Save acForm, "frmInvoices"
End If
If Me.Rec_d_Prepayment <> 0 And Me.prepayment_month = "" Then
MsgBox "Please Update Prepayment Month"
End If
If Me.Rec_d_Prepayment <> 0 And Me.prepayment_month <> "" Then
MsgBox "This will be added to tblPrePayment"
End If
End Sub
答案 0 :(得分:1)
&符号在基于VB的语言中将字符串连接在一起。要实施逻辑AND
运算符,请使用AND
关键字。你正在做的是将零值粘贴到Me.prepayment_month
的值。