Auto insert value in to text box...

  • Thread starter Iamstuck via AccessMonster.com
  • Start date
I

Iamstuck via AccessMonster.com

Fairly simply question:

Table 1 (tbl1):

Column 1 (clm1) – Column 2 (clm2) – Column 3 (clm3)

M – 1 – *text*
M – 2 – *text*
M – 3 – *text*
M – 4 – *text*
G – 1 – *text*
G – 2 – *text*
G – 3 – *text*


I want to add a record to the above table (tbl1), the form to do so needs to
prompt the user for the letter to go in to clm1 (limited to list, in this
case M or G) then insert that value in to the associated text box on the form.
It then needs to find the highest number in clm2 for that letter, add one to
it and insert that value in to the associated text box on the form.

So what it should do (in this case):

- You open the form
- A prompt comes up
- You select ‘G’ from the drop down box
- Press ‘ok’ on the prompt
- The prompt closes
- The text box for clm1 on the form shows ‘G’
- The text box for clm2 shows ‘4’.


What I have got so far:

- The form for adding the record
- A separate form that is acting as a prompt

What I need:

- How do I transfer the letter from the prompt form to the main ‘add record’
form? I have so far tried a couple of things including saving it to a
dedicated table, but I cannot get the main form to update.
- How do I get the ‘clm2’ text box to automatically find out the highest
existing value in the ‘clm2’ column, for that letter?

Again, I’ve spent loads of time on this problem and have gotten around a few
of the problems but these have baffled me ïŒ .
 
I

iamstuck via AccessMonster.com

Please ignore the:

- How do I get the ‘clm2’ text box to automatically find out the highest
existing value in the ‘clm2’ column, for that letter?

I've sorted that now :) it just clicked how to do it. I'm totally stock on
getting the transfer of the value to work though.
 
M

Marshall Barton

Iamstuck said:
Fairly simply question:

Table 1 (tbl1):

Column 1 (clm1) – Column 2 (clm2) – Column 3 (clm3)

M – 1 – *text*
M – 2 – *text*
M – 3 – *text*
M – 4 – *text*
G – 1 – *text*
G – 2 – *text*
G – 3 – *text*


I want to add a record to the above table (tbl1), the form to do so needs to
prompt the user for the letter to go in to clm1 (limited to list, in this
case M or G) then insert that value in to the associated text box on the form.
It then needs to find the highest number in clm2 for that letter, add one to
it and insert that value in to the associated text box on the form.

So what it should do (in this case):

- You open the form
- A prompt comes up
- You select ‘G’ from the drop down box
- Press ‘ok’ on the prompt
- The prompt closes
- The text box for clm1 on the form shows ‘G’
- The text box for clm2 shows ‘4’.


What I have got so far:

- The form for adding the record
- A separate form that is acting as a prompt

What I need:

- How do I transfer the letter from the prompt form to the main ‘add record’
form? I have so far tried a couple of things including saving it to a
dedicated table, but I cannot get the main form to update.
[]

You could have the propmt form just set the clm1 text box
directly from the combo box's AfterUpdate event:

Forms!theform.clm1textbox = Me.thevcombobox

But, I don't understand why you are using a pop up form to
prompt for the value. Why not just use a combo box for
clm1?
 
C

calum112 via AccessMonster.com

I would like to use a prompt so I can lock the fields to stop people changing
it. I've got it working codewise although it is now telling me I cannot
assign a value to it. meh, it can wait until after Christmas now.

Thanks for the help and have a ncie Christmas :) .


Marshall said:
Fairly simply question:
[quoted text clipped - 36 lines]
form? I have so far tried a couple of things including saving it to a
dedicated table, but I cannot get the main form to update.
[]

You could have the propmt form just set the clm1 text box
directly from the combo box's AfterUpdate event:

Forms!theform.clm1textbox = Me.thevcombobox

But, I don't understand why you are using a pop up form to
prompt for the value. Why not just use a combo box for
clm1?
 
M

Marshall Barton

Check to make sure the field in the form's record source is
updatable.
--
Marsh
MVP [MS Access]

I would like to use a prompt so I can lock the fields to stop people changing
it. I've got it working codewise although it is now telling me I cannot
assign a value to it. meh, it can wait until after Christmas now.

Thanks for the help and have a ncie Christmas :) .


Marshall said:
Fairly simply question:
[quoted text clipped - 36 lines]
form? I have so far tried a couple of things including saving it to a
dedicated table, but I cannot get the main form to update.
[]

You could have the propmt form just set the clm1 text box
directly from the combo box's AfterUpdate event:

Forms!theform.clm1textbox = Me.thevcombobox

But, I don't understand why you are using a pop up form to
prompt for the value. Why not just use a combo box for
clm1?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top