Thread: VBA question
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bearacade[_33_] Bearacade[_33_] is offline
external usenet poster
 
Posts: 1
Default VBA question


This is not an excel question but a VBA one. I want to firstl
apologize for that but I know there are a lot of VBA gurus around.

I am trying to populate some fields in Access depending on what th
user puts in. To keep the example clear, I have a Message Bo
(MessHist), A Text Box (Textbox), a Combo Box (NewAssign) and a Chec
Box (Check44).

When a button is pressed, it first makes

MessHist = MessHist & Textbox

then check if NewAssign is a new value
If yes, assign new value, attach message to MessHist, if no, leav
Messhist alone

Then check if checkbox is checked
If yes, assign new value, attach message to MessHist, if no, leav
MessHist alone.

Here is the code I have .. the problem I run into is when I have a ne
value in NewAssign AND the checkbox checked. The two messaged are no
being generated. But it works fine if only the NewAssign value change
or Checkbox is checked. any help would be greatly appreciated

Private Sub BtnSbmt2_Click()

Dim Temp As String
Dim IDstamp As String
Dim Timestamp As String

Timestamp = Date & " " & Time()
IDstamp = DLookup("[FirstName] & ' ' & [LastName]", "Contacts"
"[ID] = " & [OpenedBy])

MessHist = MessHist & vbCrLf & Timestamp & " - " & IDstamp
vbCrLf & " " & Textbox & vbCrLf

If NewAssign < AssignedTo Then
AssignedTo = NewAssign
MessHist = MessHist & vbCrLf & Timestamp & " - " & IDstam
& vbCrLf & " " & Textbox & vbCrLf & vbCrLf & Timestamp & " **
Message Re-assigned to " & DLookup("[FirstName] & ' ' & [LastName]"
"Contacts", "[ID] = " & [AssignedTo]) & " ***" & vbCrLf
Else
If Check44.Value = True Then
Status = "Closed"
MessHist = MessHist & vbCrLf & Timestamp & " - " & IDstam
& vbCrLf & " " & Textbox & vbCrLf & Timestamp & " *** Messag
Closed by " & IDstamp & " ***" & vbCrLf
End If
End If

Textbox.Value = Null
Me.Refresh

End Su

--
Bearacad

-----------------------------------------------------------------------
Bearacade's Profile: http://www.excelforum.com/member.php...fo&userid=3501
View this thread: http://www.excelforum.com/showthread.php?threadid=56221