G
Guest
Hi There,
Apologies for the newbie question, but I am creating a form where I need to
update a textbox with data from existing columns, MailingFormatWeightStart
and MailingFormatWeightEnd, in a table called tblMailingFormat.
When I run the code and select an option from the combobox, it won't update
the two textboxes. The code is below, and I will gratefully accept any tips
for best practice for how I've done the code.
Private Sub cboMailingFormat_AfterUpdate()
Dim intMailoption As Integer, intWeightStart As Integer, intWeightEnd As
Variant
intMailoption = Me.cboMailingFormat
intWeightStart = DLookup("[MailingFormatWeightStart]", "tblMailingFormat",
"[MailingFormatID] =" & intMailoption)
intWeightEnd = DLookup("[MailingFormatWeightEnd]", "tblMailingFormat",
"[MailingFormatID] = " & intMailoption)
' 1 = Letters 2 = Flats 3 = Packets 4 = Light M-Bags 5 = Heavy M-Bags as in
tblMailingFormat
If Me.TxtWeightBandStart = 0 And Me.TxtWeightBandEnd = 0 _
Then Me.TxtWeightBandStart = intWeightStart And Me.TxtWeightBandEnd =
intWeightEnd
End Sub
Can anyone help me on this one? Thanks in advance!
Apologies for the newbie question, but I am creating a form where I need to
update a textbox with data from existing columns, MailingFormatWeightStart
and MailingFormatWeightEnd, in a table called tblMailingFormat.
When I run the code and select an option from the combobox, it won't update
the two textboxes. The code is below, and I will gratefully accept any tips
for best practice for how I've done the code.
Private Sub cboMailingFormat_AfterUpdate()
Dim intMailoption As Integer, intWeightStart As Integer, intWeightEnd As
Variant
intMailoption = Me.cboMailingFormat
intWeightStart = DLookup("[MailingFormatWeightStart]", "tblMailingFormat",
"[MailingFormatID] =" & intMailoption)
intWeightEnd = DLookup("[MailingFormatWeightEnd]", "tblMailingFormat",
"[MailingFormatID] = " & intMailoption)
' 1 = Letters 2 = Flats 3 = Packets 4 = Light M-Bags 5 = Heavy M-Bags as in
tblMailingFormat
If Me.TxtWeightBandStart = 0 And Me.TxtWeightBandEnd = 0 _
Then Me.TxtWeightBandStart = intWeightStart And Me.TxtWeightBandEnd =
intWeightEnd
End Sub
Can anyone help me on this one? Thanks in advance!