Dave,
If it was mine, I would put a Condition for the OpenForm action, along the
lines of this:
DCount("*","NameOfTableCompetitorsFormBasedOn","[TempEntryID]='" & [Text0] &
"'")>0
Then again, I think if it was mine, I think I would dispense with the
Barcode Search form in any case, and use a SetTempVars macro to capture the
output of the barcode scanner, and then go straight to an OpenForm action in
which case the Condition something like:
--
Steve Schapel, Microsoft Access MVP
"Blakey300" <(E-Mail Removed)> wrote in message
news:BD0E4C1C-18B1-4B02-BBA3-(E-Mail Removed)...
> Steve
>
> My Macro is as follows:
>
> Open Form Competitors
> Where ="[TempEntryID]=" & "'" & [Text0] & "'"
> Close Form Barcode Search
>
> The macro is triggered via AfterUpdate of text0 control in the barcode
> search form
>
> The Value is entered into text0 via the barcode scanner (the barcode
> scanner
> automatically types the barcode then presses enter which then fires the
> macro)
>
> "Steve Schapel" wrote:
>
>> Hi Dave,
>>
>> Sorry to be dense here. Can you tell us what are the Actions in your
>> macro,
>> and what event is the macro assigned to i.e. what triggers it? How does
>> the
>> ID value get written to the Text0 control on the Search Form?
>>
>> --
>> Steve Schapel, Microsoft Access MVP
>>
>>
>> "Blakey300" <(E-Mail Removed)> wrote in message
>> news:00139BA7-4B1C-47A0-9F96-(E-Mail Removed)...
>> > Because the form is opened automatically when a barcode is scanned. The
>> > 1st
>> > form is an unbound search form.
>> >
>> > So when a barcode is scanned it will go straight to the relevant
>> > record,
>> > but
>> > if the record is not scanned i need it to abort the macro
>> >
>> > "Steve Schapel" wrote:
>> >
>> >> Dave,
>> >>
>> >> Why do you want to open the Competitiors form if there is no matching
>> >> record? And then close it again? Any reason to just not open it in
>> >> the
>> >> first place?
>> >>
>> >> --
>> >> Steve Schapel, Microsoft Access MVP
>> >>
>> >>
>> >> "Blakey300" <(E-Mail Removed)> wrote in message
>> >> news:7C6795CB-FCD3-4EBD-809D-(E-Mail Removed)...
>> >> > Hi
>> >> >
>> >> > I am using access 2007
>> >> >
>> >> > I have 2 forms which are as follows:
>> >> >
>> >> > Barcode Search Form (This is just a search form with unbound field)
>> >> >
>> >> > Competitors (This form holds the data)
>> >> >
>> >> > I have a macro that opens Competitors form using a where condition
>> >> > (="[TempEntryID]=" & "'" & [Text0] & "'")
>> >> >
>> >> > I would like to have it so that if the record is not found the the
>> >> > competitors form is automatically closed and a messge box appears.
>> >> > then
>> >> > reverts back to the barcode search form.
>> >> >
>> >> > In summary I want
>> >> >
>> >> > open competitors form where ="[TempEntryID]=" & "'" & [Text0] & "'"
>> >> > IF
>> >> > no
>> >> > record found close Competitors, run message box then open barcode
>> >> > search
>> >> > form
>> >> >
>> >> > Any help would be greatly appriecated
>> >> >
>> >> > regards
>> >> >
>> >> > dave
>> >>
>> >>
>>
|