#Navn? after refreshing Table-Form through searchfunction

iskov

Registered User.
Local time
Today, 01:16
Joined
Apr 1, 2015
Messages
30
Hello there access-programmers

I am having some minor issues with my current database. The way it works currently is having a MainMenu where you can either go to customers/ProductList/Product OR ProductList straight away. I have a CustomerT and a ProductT.

I have made a Query where I link the two tabels to have the feature showing the customer to the specific product with the criteria:
"Kunde: [CustomerName] & " " & [Subsidiary]"

on the form I have a txtsearch (Textbox) connected to a button with this coding:

PHP:
Private Sub Kommandoknap49_Click()

Dim strsearch As String
Dim strText As String
If (Len(txtsearch.Value) > 0) Then
strText = Me.txtsearch.Value
strsearch = "SELECT * from ProduktT where ((Kunde like ""*" & strText & "*"") or(SerieNummer like ""*" & strText & "*"") or (ProduktNavn like ""*" & strText & "*"") or (TypeNummer like ""*" & strText & "*"") or (HøjreVenstre like ""*" & strText & "*"") or (InstallationsDato like ""*" & strText & "*"") or (SidsteService like ""*" & strText & "*""))"
Me.RecordSource = strsearch
Else
strsearch = "SELECT * from ProduktT"
Me.RecordSource = strsearch
End If

End Sub

This allows me to search for text in each of the boxes with information on the single product(s) for example searching for Kunde (Customer in Danish) or ProduktNavn (Name of product) HOWEVER when I do this the "Kunde" turns into "#Navn?" can anyone possibly enlighten me on how to fix this problem??

If i reopen the Form it will show with the right information. I also tried to code the "Byactivation" to
PHP:
Forms!ProduktListeMainMenuF.Requery
that does not help.

Thanks in advance
Anders Iskov
 
How stupid of me, I obv shouldnt search from ProductT rather the Query I have assigned the Form.

I will let this information stand as I find this textbox search function very helpful and maybe it will inspire people to do a similar thing in their Databases :-)
 
Try using the AfterUpdateEvent and use Me.Requery.


HTH
 

Users who are viewing this thread

Back
Top Bottom