S
sara
I have a table with lots of dates. Some default to today
when the record is created (=Date()) and some default to
today (=Date()) when the user does something, like changes
an item on the record.
My problem is that while all seem to be set up the same
(mm/dd/yyyy as format in the table, or ShortDate), onthe
ChangeDate, I keep getting the TIME added to the table.
This causes reports not to select the changed record,
since the user only enters date. I just want the date - I
have no use for the time. Is there a way to do that? I
don't know what code you'd need to see, so I didn't
attach any for that.
2. I have the user choose a Dept and DeptName from a drop-
down combobox on a form. When I carry over the info to
the "add" form, the deptnumber comes over correctly, but
the name does not. The first department nanme in the list
shows, even tho the prior form is correct. Do I have to
put it into a combo box on the second form? I have the
row selection doing the query - 5 fields, bound on field 4
(DeptNum). DeptName is in field 5. (The first 3 are
MerchantKey, FirstName, LastName).
Here is my code: (Please forgive some - I'm a newbie to
Access forms, etc. the only "programmer" in my company -
any help/improvements are appreciated)
Private Sub cmdAddNewPO_Click()
On Error GoTo Err_cmdAddNewPO_Click
Dim PONum As Long
Dim MerchantKey As Long
Dim MerchFirstName As String
Dim MerchLastName As String
Dim DeptNum As Long
Dim DeptName As String
Dim ctl As Control
'Code from Access Day
Dim frm As Form
DeptName = Me.DeptName
' Put in some code HERE TO MAKE SURE PONUM IS UNIQUE
' Get some help -post?-on figuring out how to do this
'Subtract one day from Current date as default
DoCmd.OpenForm "FrmAddPO", , , acFormAdd,
acWindowNormal
Set frm = Forms!FrmAddPO
Do While Not CurrentProject.AllForms(frm.Name).IsLoaded
DoEvents
Loop
'Defaults for Record to add - Merchant Name and PODate
With Me
frm.PONum = Me.lngPONumtoAdd
frm.MerchantKey = Me.MerchantKey
frm.MerchFirstName = Me.MerchFirstName
frm.MerchLastName = Me.MerchLastName
frm.DeptNum = Me.DeptNum
frm.DeptName = Me.DeptName
End With
Exit_cmdAddNewPO_Click:
Exit Sub
Err_cmdAddNewPO_Click:
MsgBox Err.Description
End Sub
Thank you very much -
Sara
when the record is created (=Date()) and some default to
today (=Date()) when the user does something, like changes
an item on the record.
My problem is that while all seem to be set up the same
(mm/dd/yyyy as format in the table, or ShortDate), onthe
ChangeDate, I keep getting the TIME added to the table.
This causes reports not to select the changed record,
since the user only enters date. I just want the date - I
have no use for the time. Is there a way to do that? I
don't know what code you'd need to see, so I didn't
attach any for that.
2. I have the user choose a Dept and DeptName from a drop-
down combobox on a form. When I carry over the info to
the "add" form, the deptnumber comes over correctly, but
the name does not. The first department nanme in the list
shows, even tho the prior form is correct. Do I have to
put it into a combo box on the second form? I have the
row selection doing the query - 5 fields, bound on field 4
(DeptNum). DeptName is in field 5. (The first 3 are
MerchantKey, FirstName, LastName).
Here is my code: (Please forgive some - I'm a newbie to
Access forms, etc. the only "programmer" in my company -
any help/improvements are appreciated)
Private Sub cmdAddNewPO_Click()
On Error GoTo Err_cmdAddNewPO_Click
Dim PONum As Long
Dim MerchantKey As Long
Dim MerchFirstName As String
Dim MerchLastName As String
Dim DeptNum As Long
Dim DeptName As String
Dim ctl As Control
'Code from Access Day
Dim frm As Form
DeptName = Me.DeptName
' Put in some code HERE TO MAKE SURE PONUM IS UNIQUE
' Get some help -post?-on figuring out how to do this
'Subtract one day from Current date as default
DoCmd.OpenForm "FrmAddPO", , , acFormAdd,
acWindowNormal
Set frm = Forms!FrmAddPO
Do While Not CurrentProject.AllForms(frm.Name).IsLoaded
DoEvents
Loop
'Defaults for Record to add - Merchant Name and PODate
With Me
frm.PONum = Me.lngPONumtoAdd
frm.MerchantKey = Me.MerchantKey
frm.MerchFirstName = Me.MerchFirstName
frm.MerchLastName = Me.MerchLastName
frm.DeptNum = Me.DeptNum
frm.DeptName = Me.DeptName
End With
Exit_cmdAddNewPO_Click:
Exit Sub
Err_cmdAddNewPO_Click:
MsgBox Err.Description
End Sub
Thank you very much -
Sara