module code

S

Striker

So I am trying to jump into module coding and would appriciate a quick mod
to accomplish so I can study the syntax.

Have a table called t_Assets with field names (Server_IP, Server_Name
Location etc)
Have a form that displays assets by Location. This form is based on a query
user inputs location code and the form brings up all servers in that
location. Form name f_AssetsbySite

On that form for an individual server I want to add a command button to
bring up all maintenance records for that server, by Server_Ip That field
in the Assets Table is called "Server_IP" and the same in table
t_AssetmaintWindow.

So since the form is already open based on a query for that location, would
I simply open the t_AssetmaintWindow table and filer the t_AssetmaintWindow
by IP address equal to the forms current Server_IP? if so can you provide
the syntax for a mod?

I hope this makes sense

Thanks
 
D

Damon Heron

First, you would not open a table from a form. Create a form for the maint.
records. To open the form with a command button, then the click event of
the button would be:
DoCmd.openform "your maintenenceform", , , "[Server_IP] = me.[Server_IP]"

Damon
 
S

Striker

OK, so it still prompts me for an ip, here is what I did. the good news is
when I type the IP, it brings up those records as expected.

Private Sub cmdMaintRecords_Click()

DoCmd.OpenForm "f_u_NewMaintRecord", , , "[Server_IP]= me.[Server_IP]"

End Sub


Damon Heron said:
First, you would not open a table from a form. Create a form for the
maint. records. To open the form with a command button, then the click
event of the button would be:
DoCmd.openform "your maintenenceform", , , "[Server_IP] = me.[Server_IP]"

Damon

Striker said:
So I am trying to jump into module coding and would appriciate a quick
mod to accomplish so I can study the syntax.

Have a table called t_Assets with field names (Server_IP, Server_Name
Location etc)
Have a form that displays assets by Location. This form is based on a
query user inputs location code and the form brings up all servers in
that location. Form name f_AssetsbySite

On that form for an individual server I want to add a command button to
bring up all maintenance records for that server, by Server_Ip That
field in the Assets Table is called "Server_IP" and the same in table
t_AssetmaintWindow.

So since the form is already open based on a query for that location,
would I simply open the t_AssetmaintWindow table and filer the
t_AssetmaintWindow by IP address equal to the forms current Server_IP?
if so can you provide the syntax for a mod?

I hope this makes sense

Thanks
 
D

Damon Heron

The Server_IP is a text field? In that case, use:
"[Server_IP]=" & " ' " & Me![Server_IP] & " ' "
Note the single quote between the double quotes that denote a text field.

Damon

Striker said:
OK, so it still prompts me for an ip, here is what I did. the good news
is when I type the IP, it brings up those records as expected.

Private Sub cmdMaintRecords_Click()

DoCmd.OpenForm "f_u_NewMaintRecord", , , "[Server_IP]= me.[Server_IP]"

End Sub


Damon Heron said:
First, you would not open a table from a form. Create a form for the
maint. records. To open the form with a command button, then the click
event of the button would be:
DoCmd.openform "your maintenenceform", , , "[Server_IP] = me.[Server_IP]"

Damon

Striker said:
So I am trying to jump into module coding and would appriciate a quick
mod to accomplish so I can study the syntax.

Have a table called t_Assets with field names (Server_IP, Server_Name
Location etc)
Have a form that displays assets by Location. This form is based on a
query user inputs location code and the form brings up all servers in
that location. Form name f_AssetsbySite

On that form for an individual server I want to add a command button to
bring up all maintenance records for that server, by Server_Ip That
field in the Assets Table is called "Server_IP" and the same in table
t_AssetmaintWindow.

So since the form is already open based on a query for that location,
would I simply open the t_AssetmaintWindow table and filer the
t_AssetmaintWindow by IP address equal to the forms current Server_IP?
if so can you provide the syntax for a mod?

I hope this makes sense

Thanks
 
S

Striker

Server_IP is a tect field, and this does not seem to work either. It opens
the foem with a blank record.


Damon Heron said:
The Server_IP is a text field? In that case, use:
"[Server_IP]=" & " ' " & Me![Server_IP] & " ' "
Note the single quote between the double quotes that denote a text field.

Damon

Striker said:
OK, so it still prompts me for an ip, here is what I did. the good news
is when I type the IP, it brings up those records as expected.

Private Sub cmdMaintRecords_Click()

DoCmd.OpenForm "f_u_NewMaintRecord", , , "[Server_IP]=
me.[Server_IP]"

End Sub


Damon Heron said:
First, you would not open a table from a form. Create a form for the
maint. records. To open the form with a command button, then the click
event of the button would be:
DoCmd.openform "your maintenenceform", , , "[Server_IP] =
me.[Server_IP]"

Damon

So I am trying to jump into module coding and would appriciate a quick
mod to accomplish so I can study the syntax.

Have a table called t_Assets with field names (Server_IP, Server_Name
Location etc)
Have a form that displays assets by Location. This form is based on a
query user inputs location code and the form brings up all servers in
that location. Form name f_AssetsbySite

On that form for an individual server I want to add a command button to
bring up all maintenance records for that server, by Server_Ip That
field in the Assets Table is called "Server_IP" and the same in table
t_AssetmaintWindow.

So since the form is already open based on a query for that location,
would I simply open the t_AssetmaintWindow table and filer the
t_AssetmaintWindow by IP address equal to the forms current Server_IP?
if so can you provide the syntax for a mod?

I hope this makes sense

Thanks
 
D

Damon Heron

The form with the button has a ServerIP box on it with a valid IP bound to
the table?
The maint. table has a ServerIP that matches?
Then it should work.....

Actually, I would not do it this way to begin with. I would have a main
form (f_AssetsbySite)
and add a subform (f_u_NewMaintRecord) with a master/child link = Server_IP.
This way,
all the info for particular record would be available on one screen - no
coding needed.

Damon


Striker said:
Server_IP is a tect field, and this does not seem to work either. It
opens the foem with a blank record.


Damon Heron said:
The Server_IP is a text field? In that case, use:
"[Server_IP]=" & " ' " & Me![Server_IP] & " ' "
Note the single quote between the double quotes that denote a text field.

Damon

Striker said:
OK, so it still prompts me for an ip, here is what I did. the good
news is when I type the IP, it brings up those records as expected.

Private Sub cmdMaintRecords_Click()

DoCmd.OpenForm "f_u_NewMaintRecord", , , "[Server_IP]=
me.[Server_IP]"

End Sub


First, you would not open a table from a form. Create a form for the
maint. records. To open the form with a command button, then the click
event of the button would be:
DoCmd.openform "your maintenenceform", , , "[Server_IP] =
me.[Server_IP]"

Damon

So I am trying to jump into module coding and would appriciate a quick
mod to accomplish so I can study the syntax.

Have a table called t_Assets with field names (Server_IP, Server_Name
Location etc)
Have a form that displays assets by Location. This form is based on a
query user inputs location code and the form brings up all servers in
that location. Form name f_AssetsbySite

On that form for an individual server I want to add a command button
to bring up all maintenance records for that server, by Server_Ip
That field in the Assets Table is called "Server_IP" and the same in
table t_AssetmaintWindow.

So since the form is already open based on a query for that location,
would I simply open the t_AssetmaintWindow table and filer the
t_AssetmaintWindow by IP address equal to the forms current Server_IP?
if so can you provide the syntax for a mod?

I hope this makes sense

Thanks
 
S

Striker

I'll give that a try.


Damon Heron said:
The form with the button has a ServerIP box on it with a valid IP bound to
the table?
The maint. table has a ServerIP that matches?
Then it should work.....

Actually, I would not do it this way to begin with. I would have a main
form (f_AssetsbySite)
and add a subform (f_u_NewMaintRecord) with a master/child link =
Server_IP. This way,
all the info for particular record would be available on one screen - no
coding needed.

Damon


Striker said:
Server_IP is a tect field, and this does not seem to work either. It
opens the foem with a blank record.


Damon Heron said:
The Server_IP is a text field? In that case, use:
"[Server_IP]=" & " ' " & Me![Server_IP] & " ' "
Note the single quote between the double quotes that denote a text
field.

Damon

OK, so it still prompts me for an ip, here is what I did. the good
news is when I type the IP, it brings up those records as expected.

Private Sub cmdMaintRecords_Click()

DoCmd.OpenForm "f_u_NewMaintRecord", , , "[Server_IP]=
me.[Server_IP]"

End Sub


First, you would not open a table from a form. Create a form for the
maint. records. To open the form with a command button, then the
click event of the button would be:
DoCmd.openform "your maintenenceform", , , "[Server_IP] =
me.[Server_IP]"

Damon

So I am trying to jump into module coding and would appriciate a
quick mod to accomplish so I can study the syntax.

Have a table called t_Assets with field names (Server_IP, Server_Name
Location etc)
Have a form that displays assets by Location. This form is based on
a query user inputs location code and the form brings up all servers
in that location. Form name f_AssetsbySite

On that form for an individual server I want to add a command button
to bring up all maintenance records for that server, by Server_Ip
That field in the Assets Table is called "Server_IP" and the same in
table t_AssetmaintWindow.

So since the form is already open based on a query for that location,
would I simply open the t_AssetmaintWindow table and filer the
t_AssetmaintWindow by IP address equal to the forms current
Server_IP? if so can you provide the syntax for a mod?

I hope this makes sense

Thanks
 

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