Current Date Function and Combo Box Question

TigerGyrlAlly

New Member
Joined
Jun 11, 2003
Messages
18
I am creating a table and form in Access. What I've done so far is setup a table with three fields in it - An autonumber ID field, a clientID field and a Date field.

The form contains the clientID field and Date field from this table along with client name and client number from another table.

What has to happen is that when the form is open, a code will be scanned, which will populate the client name and client number fields as well as the date field. The date field is supposed to be the current date of the scan. Is there a function that I can use? I tried today and now, but haven't had any luck so far. Maybe i'm just wrong in the syntax...I used Now() and Today() in the Default value field in the Design View of my underlying table.

Also, for my clientID, client name and client number fields I set them as combo boxes so that data can still be entered manually. Is there any way to get all of the information to show by clicking the arrow? Right now when a scan is done, the client name and number info is populated and even if I wanted to scroll to something else I could not. And is there a way to make the box so that I may scan the code and the information be populated automatically, while at the same time allowing me to enter data manually and allowing me to search for data already in the tables by typing the first few letters of what i'm looking for?

:rolleyes: Can anyone help????
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Try Date()

While I'm at it. I put this in the OnKeyPress event for the control.
Somethign I dug up off http://www.mvps.org/access/ one day and it seemed just really really neat at the time.

Code:
Private Sub Date_of_Change_KeyPress(KeyAscii As Integer)

    Call PlusMinus(KeyAscii, "frmChanges", "sfmChanges1")

End Sub

'Code Courtesy of
'Jason Looney
'
Public Function PlusMinus(intKey As Integer, strFormName As String, Optional _
    strSubformName As String = "", Optional strSubSubFormName As String = "") _
    As Integer

'Allows a date or number field on a form or subform to respond to plus/minus keys
'Sample Usages (in the Keypress event):
'   Call PlusMinus(KeyAscii, Me.Name)
'   Call PlusMinus(KeyAscii, Me.Parent.Name, Me.Name)
'   Call PlusMinus(KeyAscii, Me.Parent.Parent.Name, Me.Parent.Name, Me.Name)

On Error GoTo TheHandler
Dim ctl As Control
    
    If strSubformName <> "" Then
        If strSubSubFormName <> "" Then
            Set ctl = Forms(strFormName).Controls(strSubformName).Form.Controls(strSubSubFormName).Form.ActiveControl
        Else
            Set ctl = Forms(strFormName).Controls(strSubformName).Form.ActiveControl
        End If
    Else
        Set ctl = Forms(strFormName).ActiveControl
    End If
    
    ctl = CDate(ctl)
    
    Select Case intKey
        Case Is = 43        'the '+' key
            ctl = ctl + 1
            intKey = 0
        Case Is = 45        'the '-' keys
            ctl = ctl - 1
            intKey = 0
        Case Is = 61        'the '='/'+' key next to Backspace
            ctl = ctl + 1
            intKey = 0
    End Select
           
ExitHandler:
    PlusMinus = intKey
    Set ctl = Nothing
    Exit Function

TheHandler:
    Select Case Err.Number
        Case Is = 94    'Invalid use of null
        Case Is = 13    'Type mismatch
        Case Else
            MsgBox Err.Number & ":  " & Err.Description
            intKey = 0
    End Select
    Resume ExitHandler
End Function
 
Upvote 0

Forum statistics

Threads
1,221,543
Messages
6,160,422
Members
451,644
Latest member
hglymph

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top