Re: List Box to Open Form



Tina,
Thank you so much for the prompt reply and it worked very well.
Would you mind looking at the following code and letting me know what I'm
doing wrong. I have set fields "StartTime" and "StopTime" and can get it to
calculate on a field with an Elapsed Time String code for each record on a
data***. I want to total the amount of time for the total job and have
set up the following "HoursAndMinutes" module code. When I enter
=HoursAndMinutes([StartTime]-[StopTime]) OR
=HoursAndMinutes(Sum([StartTime]-[StopTime])), I get the msg "The object
doesn't contain the Automation Object 'HoursAndMinutes'
Public Function HoursAndMinutes(interval As Variant) As String
'***********************************************************************
' Function HoursAndMinutes(interval As Variant) As String
' Returns time interval formatted as a hours:minutes string
'***********************************************************************
Dim totalminutes As Long, totalseconds As Long
Dim hours As Long, minutes As Long, seconds As Long

If IsNull(interval) = True Then Exit Function

hours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440)) ' 1440 = 24 hrs * 60 mins
minutes = totalminutes Mod 60
totalseconds = Int(CSng(interval * 86400)) ' 86400 = 1440 * 60 secs
seconds = totalseconds Mod 60

If seconds > 30 Then minutes = minutes + 1 ' round up the minutes and
If minutes > 59 Then hours = hours + 1: minutes = 0 ' adjust hours
HoursAndMinutes = hours & ":" & Format(minutes, "00")

End FunctionThe help is greatly appreciated!!"tina" <nospam@xxxxxxxxxxx>
wrote in message
news:GH6Bf.287818$qk4.188684@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> if there is a possibility that a record will have Receiving data entered,
> but not Disassembly data entered, *when you move to that record*, then
> change the Current event to
>
> If IsNull(Me!Receiving) Then
> DoCmd.OpenForm "fPopUpReceiving"
> ElseIf IsNull(Me!Disassembly) Then
> DoCmd.OpenForm "DisassemblyFormName"
> End If
>
> again, if you don't want the pop-ups on new blank records, then change the
> above to
>
> If Not Me.NewRecord Then
> If IsNull(Me!Receiving) Then
> DoCmd.OpenForm "fPopUpReceiving"
> ElseIf IsNull(Me!Disassembly) Then
> DoCmd.OpenForm "DisassemblyFormName"
> End If
> End If
>
> aside from the above, add the following code to the Receiving control's
> AfterUpdate event, as
>
> If IsNull(Me!Disassembly) Then
> DoCmd.OpenForm "DisassemblyFormName"
> End If
>
> hth
>
>
> "PHisaw" <PHisaw@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:CFF120EA-3347-4A76-BE1E-02B9DE8758E1@xxxxxxxxxxxxxxxx
>> Tina,
>> Thanks for the help! It worked, but can you now tell me how to keep a
> second
>> popup from opening if it has null values. Ex: If "Receiving" is null,
> per
>> your code below, it opens. I have another popup based on field
> "Disassembly"
>> being null. I don't want both of them to open up when my main form
>> opens,
>> only "Receiving" and then when it is no longer null have "Disassembly"
> start
>> opening. Is this possible?
>>
>> "tina" wrote:
>>
>> > try adding code to the Current event of fGeneralInfo, as
>> >
>> > If IsNull(Me!Receiving) Then
>> > DoCmd.OpenForm "fPopUpReceiving"
>> > End If
>> >
>> > if you only want the pop-up to open on existing records (not a new,
> blank
>> > record) then use
>> >
>> > If Not Me.NewRecord And IsNull(Me!Receiving) Then
>> >
>> > hth
>> >
>> >
>> > "Pam" <pamnospam@xxxxxxxxxxxxxxxx> wrote in message
>> > news:eyWTNrdHGHA.1312@xxxxxxxxxxxxxxxxxxxxxxx
>> > > Tina,
>> > > I got it to work - thanks so much!
>> > > Can you help me open a pop up form already created based on a field
> being
>> > > blank on another form? Ex: "fGeneralInfo" has field "Receiving". If
>> > > "Receiving" is blank, I want form "fPopUpReceiving" to pop-up when
>> > > fGeneralInfo opens with job info. I hope this isn't too confusing!
> Once
>> > > again, the help is greatly appreciated!!
>> > >
>> > > "tina" <nospam@xxxxxxxxxxx> wrote in message
>> > > news:_DVzf.275981$qk4.267767@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>> > > >> What I want to be able to do is click
>> > > >> on one of the jobs in the list box and have it open the form for
> that
>> > > >> specific job number?
>> > > >
>> > > > do you mean "open *another* form" for the specific job number? if
> so,
>> > you
>> > > > can run code from the listbox control's Click event or AfterUpdate
> event
>> > > > to
>> > > > open the form with a WHERE clause, something along the lines of
>> > > >
>> > > > DoCmd.OpenForm "FormName", , , "JobNumber = " _
>> > > > & Me!ListBoxName
>> > > >
>> > > > if the job number is a Text field, rather than a Number field, the
>> > syntax
>> > > > would be
>> > > >
>> > > > DoCmd.OpenForm "FormName", , , "JobNumber = '" _
>> > > > & Me!ListBoxName & "'"
>> > > >
>> > > > in either case, the assumption is that the job number field is the
> bound
>> > > > column in the listbox control.
>> > > >
>> > > > hth
>> > > >
>> > > >
>> > > > "Pam" <pamnospam@xxxxxxxxxxxxxxxx> wrote in message
>> > > > news:eeEBu9THGHA.1728@xxxxxxxxxxxxxxxxxxxxxxx
>> > > >> I have a combo box and a list box on a form. The combo box lists
> tech
>> > > > names
>> > > >> from a tech list table. The list box lists jobs related to each
> tech
>> > as
>> > > >> they are selected in the combo box. What I want to be able to do
> is
>> > > >> click
>> > > >> on one of the jobs in the list box and have it open the form for
> that
>> > > >> specific job number?
>> > > >> Any help is greatly appreciated!!
>> > > >> Thanks,
>> > > >> Pam
>> > > >>
>> > > >>
>> > > >
>> > > >
>> > >
>> > >
>> >
>> >
>> >
>
>


.


Loading