I would like to set a default value in DATE type column to Date(), but it
doesn't work. Is there a way to do it through column format?
If not, what should I enter in the VB code below (place where I need help
will have ????????????)
Private Sub okButton_Click()
Dim db As Database
Dim rs As Recordset
Dim rstalent As Recordset
Dim criteria As String
Dim criteria2 As String
Dim frminq As Form
Dim frmtalent As Form
criteria = "[event_id]= '" & Me![event_id] & "'"
Set db = CurrentDb()
Set rs = db.OpenRecordset("events")
rs.FindFirst criteria
If rs.nomatch Then
Set frminq = Forms!inquiries
Set frmtalent = frminq!inquiry_talent_subform.Form
With rs
.AddNew
![event_id] = Me![event_id]
![agent_id] = frminq![agent_id]
![agent_name] = frminq![agent_name]
![artist_id] = frmtalent![artist_id]
![artist_name] = DLookup("[contact_name]", "artist",
"[artist_id]= forms!inquiries!inquiry_talent_subform.form![artist_id]")
![performance_name] = Me![performance_name]
![configuration] = Me![config_description]
![corp_name] = Me![corp_name]
![contract_date]=????????????????????????????????????????????????????
![production_information] = frmtalent![production_requirements]
![additional_provisions] = frmtalent![addl_provisions]
![overtime_rate] = frmtalent![overtime_description]
![key_date] = Me![event_date]
![play_date_single] = Me![event_date]
![purchaser_organization] = Me!buyer
![contact_id] = frminq![contact_id]
![purchaser_prefix] = frminq!contact_names.Form![contact_prefix]
![purchaser_name_first] =
frminq!contact_names.Form![contact_name_first]
![purchaser_name_last] =
frminq!contact_names.Form![contact_name_last]
![individual_contact_id] = frminq![indiv_contact_id]
![purchaser_address_1] = frminq![mailing_address_1]
![purchaser_address_2] = frminq![mailing_address_2]
![purchaser_city] = frminq![city]
![purchaser_state] = frminq![state]
![purchaser_zip] = frminq![zip]
![purchaser_phone] = frminq![phone]
![purchaser_fax] = frminq![fax]
![place_1] = frminq![event_location]
![event_type_hours_1] = frminq!hours
![compensation_numeric] = Me![price]
.Update
End With
frminq!status = "active"
Set rstalent = frmtalent.RecordsetClone
criteria = "inquiry_id=" & frmtalent!inquiry_id & " And [hold_id]
is not null"
rstalent.FindFirst criteria
If Not rstalent.nomatch Then
Do Until rstalent.EOF
criteria2 = "[event_id]='" & rstalent![hold_id] & "'"
rs.FindFirst criteria2
If Not rs.nomatch Then
rs.Delete
rstalent.edit
rstalent![hold_id] = Null
rstalent![hold_expire] = Null
rstalent.Update
Else
' rstalent.MoveNext
End If
rstalent.FindNext criteria
If rstalent.nomatch Then GoTo cleanup
Loop
End If
Else
If msgbox("That event_id already exists. Do you want to view the
Issue Contract form for that event?", vbYesNo, "STOP") = vbNo Then
rs.Close
Set rs = Nothing
Set db = Nothing
DoCmd.Close
End
Else
rs.Close
Set rs = Nothing
Set db = Nothing
DoCmd.Close
Exit Sub
End If
End If
cleanup:
frminq![event_id] = Me![event_id]
frminq![event_id Box].Visible = True
frminq![event_id Label].Visible = True
frminq![event_id].Visible = True
Set frminq = Nothing
Set frmtalent = Nothing
rs.Close
rstalent.Close
Set rs = Nothing
Set rstalent = Nothing
Set db = Nothing
DoCmd.Close
End Sub