Need Help with Access

sledgehammer

New member
Local time
Yesterday, 17:39
Joined
Aug 10, 2021
Messages
3
This is some simple code I wrote. I run it through debug and get no errors. When I put quick watch in the debug they show <out of context>. I have tried everything I can think of and nothing works.

Public Sub txtGoto_Enter()
Dim MyString As String

Open "C:\Residents\Residentvb.accdb" For Input As #1
Do Until EOF(1)
Input #1, MyString
If gotolot = LotNo Then
End If

Loop

Close #1
End Sub
 
Do you have Option Explicit at the top of your module?

What is this meant to do? :unsure:
Code:
If gotolot = LotNo Then
End If
 
In the database is a field gotolot where I want to key in a number and find that number in Lotno which is also in the database. I am trying to do a random lookup. These are also fields in my form.
 
Last edited:
What exactly are you trying to accomplish? A database has tables that have fields.
Typically you would have a form(s) to interact with data stored in tables.
Can you show us your table(s) structure(s), and a jpg of your form?
 
You might be able to do what you want with a query. Link to the text file. Then create a query that joins the table to the linked textfile. Only the matches will be returned. The query will not be updateable because the linked text file is not updateable. If you need to update the existing table, you will need to import the text file and then join the imported table to the existing table.
 
The loop you have written will run straight through that entire file because you have not tied anything of the input to your ending condition. You will reach the EOF every time. Is that what you wanted? Because that is what you wrote.
 
an Access Database is not a Text file?
use Binary when you Open?

you create a Linked table on your db (if Residentvb.accdb is an external db)
to your db.

use DLookup() to get the value you want.
 

Users who are viewing this thread

Back
Top Bottom