Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pop up Data entry window.

Status
Not open for further replies.

jimfrmla

Programmer
Nov 11, 2004
16
US
Does anyone know how to get a data entry window to pop up after you compare a value to a table and the value doesn't exist in the table? I now how to create a combo box and have it auto populate but this isn't the same thing. If the value typed into the field does not match anything in the table it is referencing I need a data entry window to pop up so that the info can be put in. Example;

I put in a shipper number. If the shipper number exists in the table nothing happens and I can go on keying into the next field in the form. If the shipper number doesn't exist in the table I need to have a data entry window pop up so I can enter the entire shipper information.

Thanks in advance to anyone who has a possible solution to this.
 
Look under Data and Validation Rule and Validation Text for that control.

You can enter like >20

Can accept values bigger than 20

and the rest is done automatically.

Of course you can't create more complex validation rules
 
You can use "Not in List" or "After Update" Event to open the new form
Something like this
Code:
Private Sub ShipperCombo_AfterUpdate()
If ItemName.ListIndex <> -1 Then
Exit sub
Else
[green][b]'Put the code to open the form[/b][/green]
End if
End sub


Zameer Abdulla
Visit Me
 
How are ya jimfrmla . . . . .

In the [blue]AfterUpdate event[/blue] of [blue]ShipperNo[/blue], something like this (the code assumes ShipperNo is text, if numeric, remove both single quotes):
Code:
[blue]   Criteria = "[ShipperNo]='" & Me![ShipperNo] & "'"
   
   If IsNull(DLookup("PrimaryKeyName", "TableName", Criteria)) Then
      DoCmd.OpenForm "YourFormName", acNormal
   End If[/blue]

Calvin.gif
See Ya! . . . . . .
 

One other thought-

In the pop-up you may have a Save button to record the new shipper number. You may want to have a vbyes/no to ask the question "confirm the shipper number" or something like this. If a user accidently types in an incorrect shipper number (ie, may have transposed), hopefully, they will double check to make sure they have the correct number. If the user finds they accidently erred, they can cancel, thus not having two different shipper numbers for the same shippment.
Although there is no way to be 100% accurate, there are human beings doing the work. Consequently, people are prone to make mistakes.

Good Luck with your project!

An investment in knowledge always pays the best dividends.
by Benjamin Franklin
Autonumber Description - FAQ702-5106
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top