I have the following procedure that I am having problems with. I compared it to another procedure that is almost identical and found that tmpAcct# = GSB is giving me trouble. I had GSB as “GSB” since it is text going into a text field using the dim default of variable. If I have the quotes in I get a type mismatch but if I have numbers in quotes instead of GSB (i.e. “2320”) it works fine. If I leave the quotes off the field gets a “0” entered instead of GSB.
Private Sub cmdNewDisbursement_Click()
On Error GoTo Err_cmdNewDisbursement_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim tmpAcct#, tmpLease#, tmpDate, tmpnotes
tmpAcct# = GSB
tmpLease# = Me![lease#]
tmpDate = Date
tmpnotes = Me![last] & ", " & Me![First] & " Lease Payment"
stDocName = "Disbursement"
DoCmd.OpenForm stDocName, , , stLinkCriteria
[Forms]![disbursement]![Acct#] = tmpAcct#
[Forms]![disbursement]![lease#] = tmpLease#
[Forms]![disbursement]![Date] = tmpDate
[Forms]![disbursement]![Notes] = tmpnotes
Exit_cmdNewDisbursement_Click:
Exit Sub
Err_cmdNewDisbursement_Click:
MsgBox Err.Description
Resume Exit_cmdNewDisbursement_Click
End Sub
I checked the table field and that is set as a standard text field. The form Disbursement Acct# field does not have anything in the format control. It makes no sense to me so if someone could help it would be appreciated. Thanks.
Private Sub cmdNewDisbursement_Click()
On Error GoTo Err_cmdNewDisbursement_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim tmpAcct#, tmpLease#, tmpDate, tmpnotes
tmpAcct# = GSB
tmpLease# = Me![lease#]
tmpDate = Date
tmpnotes = Me![last] & ", " & Me![First] & " Lease Payment"
stDocName = "Disbursement"
DoCmd.OpenForm stDocName, , , stLinkCriteria
[Forms]![disbursement]![Acct#] = tmpAcct#
[Forms]![disbursement]![lease#] = tmpLease#
[Forms]![disbursement]![Date] = tmpDate
[Forms]![disbursement]![Notes] = tmpnotes
Exit_cmdNewDisbursement_Click:
Exit Sub
Err_cmdNewDisbursement_Click:
MsgBox Err.Description
Resume Exit_cmdNewDisbursement_Click
End Sub
I checked the table field and that is set as a standard text field. The form Disbursement Acct# field does not have anything in the format control. It makes no sense to me so if someone could help it would be appreciated. Thanks.