I have a combo box that has a status in it and when it is changed from Open to Closed, transferred or Pending I would like to populate two text boxes with the current date and time. I have an after update module created that looks at the value of the combo box and then updates the text of the text box to the current date and time but it is not working.
It either doesn't do anything or I get an error about setting the focus. I appreciate any help.
If Me.CmbStatus.Value = "Closed" Then
Me.Date_Completed.Text = Date
Me.Time_Completed.Text = Time
ElseIf Me.CmbStatus.Value = "Pending" Then
Me.Date_Completed.Text = Date
Me.Time_Completed.Text = Time
ElseIf Me.CmbStatus.Value = "Transferred" Then
Me.Date_Completed.Text = Date
Me.Time_Completed.Text = Time
Related
I have a google sheet with columns set up as dates.
So, A2=1/1/2021, A3 = 1/2/2021, A4 = 1/3/2021 and so on. This is (m/d/yyyy)
This is how it looks like:
Dates
I wish to do a lookup to find the date matching it with my calendar event.
I extract my calendar event with below.
var id_cal = sheet.getRange("A1").getValue();
var cal= CalendarApp.getCalendarById(id_cal);
var start_time = sheet.getRange("A2").getValue();
var end_time = sheet.getRange("B2").getValue();
var events = cal.getEvents(new Date(start_time), new Date(end_time))
for(var i = 0;i<events.length;i++){
var start_time = events[i].getStartTime();
...
}
*EDIT:
The script pulls calendar events from G.Cal.
The event title need to be placed in the second row in the google sheet (see image)
So if the calendar event starts on 3rd Jan, it will be placed below the cell that shows '3' in the image.
So,
var detail = events[i].getTitle();
sheet.getRange(row=2,column= X ) = "My event : " + detail ;
I need to find 'X', based on the date in start_time().*
Without app script, match function works best. but it doesn't work in app script. I would really like to avoid 365 iterations of the for loop for every event. It would be nice if there was a way to use match() or hlookup(), within the appscript.
EDIT2: This is how the image must look like:
Target
How do I fill the events in Row 2 from my google calendar. So that they appear below the cell with correct date.
Example: There is a meeting with A on 1/1/2022.
I need some help since I am new to this, appreciate any inputs. I am trying to setup a script to create a calendar event, asking me date, time and duration of the event, but I am messing up something since it keeps giving me errors such as Can’t make "19.12.1820:06:17" into type number, I guess they are related to formatting or something else?
tell application "Calendar"
activate
tell calendar "Work"
set theCurrentDate to short date string of (current date)
set theCurrentTime to time string of (current date)
--Get event Summary
display dialog "Enter event name:" default answer "Appointment"
set eventName to text returned of the result
--Get date
display dialog "Please enter a date for your event" default answer theCurrentDate
set eventDate to text returned of the result
--Get time
display dialog "Please enter start time" default answer theCurrentTime
set eventTime to text returned of the result
set eventStart to eventDate & eventTime
--Get duration
display dialog "Please enter duration in minutes" default answer "120"
set eventDuration to text returned of the result
set eventEnd to eventStart + (eventDuration * minutes)
make new event at end with properties {summary:eventName, location:"url Intercall: xxx PIN: xxx", start date:eventStart, end date:eventEnd, url:"url"}
end tell
reload calendars
end tell
I have a memo field which contains rich text. I am able to identify a user and change all the text in the box instead of just the text they added.
I am looking to write code which allows the text to be edited and after update , the edited text will appear a different color than the original text in the memo field.
I have tried :
Dim strNew As String
Dim strOld As String
If Me.txt_username_id = "grant" Then
strOld = Me.Form!txtnotesaboutproduct1.OldValue.ForeColor = vbBlack<br/>
strNew = Me.Form!txtnotesaboutproduct1.ForeColor = vbRed
End If
I have also tried
Dim ctlOld As TextBox<br/>
Set ctlOld = Me.Form!txtnotesaboutproduct1
If Me.txt_username_id = "grant" Then
ctlOld = Me.Form!txtnotesaboutproduct1.OldValue.ForeColor = vbRed
End If
Generally, I do this with a continuous subform for Notes, so that I can hold the data, date and user, rather than just one formatted text box. Though I do realize this might be a lot more real estate that you might have, you can use a conditional format within the subform. I do agree that if it is possible, you'll likely need to use HTML and not .Forecolor, which will change the entire box.
Just starting to use VS2013. Have several projects that I am porting from older technology. This should be really simple, so I am sure I am missing something easy.
The combo box is used to build a record. There is an ID field and a Description field. Very simple. I am trying to show the Description (which is text), but save the ID (which is int).
DataSource = table1BindingSource
DisplayMember = Description
ValueMember = ID
Databinding.Text = table2BindingSource.field1
I have tried setting
Databinding.SelectedValue = ID
and
Databinding.SelectedItem = ID
It displays in the dropdown correctly. It displays in the field correctly, using the Description. But value must not be associated with the field correctly, because I cannot save or move to the next record. Looks like the Description is getting put in the field1, and as it is int, it is not accepting it.
What am I missing?
I got it. For text boxes, I had been assigning
DataBinding.Text = Table1.field
So, I was trying to assign for combo boxes
DataSource = Table1
DisplayMember = Table1.description
ValueMember - Table1.code
and
DataBinding.SelectedValue = Table1.code
DataBinding.Text = Table2.field
I finally removed the Text statement and assigned
DataBinding.SelectedValue = Table2.field
And it all worked as desired.
I am new to the DataGridView WinForm control and just do not like data Binding. I Used to use Spread OCX back 100 years ago and found it friendly. Now I am running into a problem try to do something simple:
I have a grid with two columns:
1) Name
2) Status
I want to loop through my collection of "ChinaVisas" and display the applicant's name and the status of his application. I want to make the status column a drop drop that can allow the user to change the value by selecting a different item in the drop down list.
Here's what I am doing. I have a feeling that this isn't the data binding way that most people would code it, but here ya go:
Private Sub PopulateGridVisa()
grdVisa.Rows.Add(_Order.ChinaVisas.Count)
For r As Integer = 0 To _Order.ChinaVisas.Count - 1
Dim CurrentChinaVisa As ChinaVisa = _Order.ChinaVisas(r)
For c As Integer = 0 To grdVisa.Columns.Count - 1
Select Case c
Case 0
Dim CurrentCell As DataGridViewCell = grdVisa.Rows(r).Cells(c)
CurrentCell.Value = CurrentChinaVisa.SortName
Case 1
Dim CurrentCell As DataGridViewComboBoxCell = CType(grdVisa.Rows(r).Cells(c), DataGridViewComboBoxCell)
For Each StatusCode As StatusCode In _frmMain.ApplicationStartup.StatusCodes
If StatusCode.StatusCodeId >= StatusCodeEnum.WaitingToReceive Then
CurrentCell.Items.Add(StatusCode)
End If
If StatusCode.StatusCodeId = CurrentChinaVisa.StatusCodeId Then
CurrentCell.Value = StatusCode
End If
Next
End Select
Next
Next
End Sub
That seems to work, but when the user selects a new status value from the drop down, the following error is returned:
---------------------------
DataGridView Default Error Dialog
---------------------------
The following exception occurred in the DataGridView:
System.ArgumentException: DataGridViewComboBoxCell value is not valid.
To replace this default dialog please handle the DataError event.
---------------------------
OK
---------------------------
Why?
enter code hereDon't add the StatusCode object to the Items collection as shown here:
CurrentCell.Items.Add(StatusCode)
Add a String and see if it works
CurrentCell.Items.Add(StatusCode.ToString)