Input Box entry to a table ?

  • Thread starter Thread starter Ms. DE Velop Her
  • Start date Start date
M

Ms. DE Velop Her

I must place some code behind a command button (on a Form) that would prompt
the user for a batchID num , then add that input to a table field (BacthID)

Please advise the most feasible way / method
 
It all depends on how complex you want to make it.

Easy Way
======
Just create a simple prompt using the InputBox:

Dim response As string
response = Trim(InputBox("Batch ID: ", "Input Required"))

Then you should add some checking to ensure that the user has actually
entered something; else either prevent them from continuing or prompt them
again.

Complex Way
=========
Build a form with another text box and just call Docmd.OpenForm to display
the form.

Personally I would just go with the InputBox function since you don't need
to rely on managing the state of multiple forms if further code execution is
required once the users input is complete.

Once you have the value then you can just either perform an insert or update
back to the table (you didn't indicate if a record already existed).

HTH,

Lance
 
Ms. DE Velop Her said:
I must place some code behind a command button (on a Form) that
would prompt the user for a batchID num , then add that input to a
table field (BacthID)

Please advise the most feasible way / method

The simplist way is to base the form on the table or a query based on the
table and add BacthID to that form.
Without knowing what comes next it's hard to be more specific.
 
Are you speaking of using a recordset (DAO) to perform an insert or update ,
using RunSQL to the table??

The records exist, but I want the user to give me the batch number so that I
can place the bath number on the Batch Id Field of the table where the other
fields are populated. In other words, all records meeting the criteria of
having no blank fields, get the Batch number added and these records will be
used to make a Export table with the Batch number of "Whatever the user
assigns"
 
The users sees a form with record information from a table, the user then
modifys the table via the form entering data into the fields...once all
information added sucessfully, those complete records are to be appended to
another table for a export into a spreadsheet. But first the users needs to
assign a batch number to all records that will be exported
 
Back
Top